LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-11-2005, 12:40 PM   #1
Simkin
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Rep: Reputation: 0
Question [suse93/kde] service menu is not working


Hi all,

I try to add a service menu for KDE which runs one of the simple scripts I made:
mountiso.sh
Code:
#!/usr/bin/env bash

mkdir "$HOME"/ISO/
mkdir "$HOME"/ISO/"$1"
sudo mount -o loop -t iso9660 "$1" "$HOME"/ISO/"$1"/
and

unmountiso.sh
Code:
#/usr/bin/env bash

sudo umount "$1"
rmdir "$HOME"/ISO/"$1"/
I made the following service menu:
mountISO.desktop
Code:
[Desktop Entry]
ServiceTypes=application/x-iso
Actions=MountISO;UnmountISO
X-KDE-Submenu=Mount image

[Desktop Action MountISO]
Name=Mount image
Icon=background
Exec=/home/simkin/Documents/scripts/mountiso.sh %u

[Desktop Action UnmountISO]
Name=Unmount image
Icon=background
Exec=/home/simkin/Documents/scripts/unmountiso.sh %u
When I select an ISO image the submenu is displayed under "actions" and I can choose to mount or unmount the image.

However the only part which is working is that the $HOME/ISO directory is made.
The image itself is not mounted and the directory with the filename ($1) is also not made.

I am very new into scripting and working with service menu`s.
So I am hoping someone is abel to point me in the right direction

Many thanks in advance!
 
Old 07-11-2005, 07:30 PM   #2
fsateler
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Debian Unstable
Posts: 107

Rep: Reputation: 15
I am no expert at kde service menus, but it ocurs to me that the name you are receiving is not the one you want (perhaps receiving full paths instead of only the file name). Try echoing $1 to see if this is the problem.
 
Old 07-12-2005, 08:30 AM   #3
Simkin
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Original Poster
Rep: Reputation: 0
You were right!
I used the following script:
Code:
#!/usr/bin/env bash

echo $1 > /home/simkin/Desktop/test.txt
mkdir "$HOME"/ISO/
mkdir "$HOME"/ISO/"$1"
sudo mount -o loop -t iso9660 "$1" "$HOME"/ISO/"$1"/
and noticed that the output contained a full path.
Now I need to find out how to filter it so I will only see the basename.

Suggestions are welcome!

Last edited by Simkin; 07-12-2005 at 03:05 PM.
 
Old 07-12-2005, 04:42 PM   #4
Simkin
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Original Poster
Rep: Reputation: 0
Finaly got the script working (seems so simple when you know how)
Now I need to find out how to let the mount commands to be executed as root, any suggestions?

Code:
#!/usr/bin/env bash

fullpath=$1
filename=`basename $fullpath`

mkdir "$HOME"/ISO/
mkdir "$HOME"/ISO/"$filename"
sudo mount -o loop -t iso9660 "$1" "$HOME"/ISO/"$filename"
Code:
#/usr/bin/env bash

fullpath=$1
filename=`basename $fullpath`

sudo umount "$HOME"/ISO/"$filename"
rmdir "$HOME"/ISO/"$filename"
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
close down service menu on zaurus sl5500 esteeven Linux - Laptop and Netbook 7 09-26-2005 06:43 AM
nforce sound drivers suse93 rokka SUSE / openSUSE 16 06-07-2005 04:20 PM
Where is the KDE "menu editor" or the actual menu located in KDE 3.1? GoSTaRnE Linux - General 3 05-23-2004 08:37 AM
Add KDE menu in Gnome start menu melinda_sayang Slackware 2 03-06-2004 05:26 AM
KDE applications menu replaced by Gnome style menu denh0 Mandriva 2 11-24-2003 12:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration