Simple mount Iso service menu

Dolphin Service Menus

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

2
Become a Fan
7.2

Description:
This is a simple mount image service menu.

Thanks to janet and feder77 for help and suggestions

How work:

MOUNT:
- right click on iso image
- select "Actions" -> "mount iso"
- select folder where mount
- insert root password
- mounted!

UNMOUNT:
- since kde 4.9, mounted image are listed in the "places" panel. Right click on mounted image then click "unmount"
Last changelog:

Version 1.2

- Correct file with space handling (thx to Jtalk)

Version 1.1

- use kdesu or kdesudo dinamically
- menu moved into actions menu
- removed "unmount" option


Ratings & Comments

19 Comments

xalalau

Here is another fix (for KDE 5 Plasma): http://www.mediafire.com/file/l4oi6srop93xvg7/SimpleMountISO.zip [quote][Desktop Action mountiso] Exec=mntDir="/mnt"; [ "$(ls -A $mntDir)" ] && mntDir=`kdialog --getexistingdirectory`; [ -z "$mntDir" ] && exit; suCmd="kdesudo"; command -v kdesudo >/dev/null 2>&1 || { suCmd="kdesu" >&2; }; `echo $suCmd` -c "mount -o loop -t iso9660 \""%u\"" \""$mntDir\"""; [ "$(ls -A $mntDir)" ] && `dolphin "$mntDir"` || exit; Icon=media-optical Name=Mount iso Name[it]=Monta immagine Name[en]=Mount iso image Name[pt_BR]=Montar imagem ISO [Desktop Entry] Type=Service X-KDE-ServiceTypes=KonqPopupMenu/Plugin,application/x-cd-image/.* MimeType=application/x-cd-image; Actions=mountiso; X-KDE-Submenu=ISO X-KDE-StartupNotify=false X-KDE-Priority=TopLevel Icon=media-optical [/quote] I added new checks, brazilian Portuguese and a new menu for this option. The folder I'm using is: [quote]~/.local/share/kservices5/ServiceMenus[/quote]

xalalau

Ops... Remove all the "[quote][/quote]" before using this script, please.

xalalau

Ops 2... Don't forget to install kdesudo: sudo apt install kdesudo

guoyunhe

After installed the service, nothing happen. Cannot see service on installed service list or context menu. Addon version 1.0, KDE 5.8.3, Dolphin 16.08.3

noric

I'd like to suggest a change from mount -o loop -t iso9660 to mount -o loop -t auto This way the scipt won't fail with udf file systems.

GHPS

A really fine tool for simply mounting an ISO file. But even the current version (1.2) has two shortcomings: It fails when either the file name or the name of the mount directory contain space characters (which is perfectly legitimate in Linux for a number of years). A number of extra quotes fixes both problems: Quote:

[Desktop Action mountiso] Exec=mntDir=`kdialog --getexistingdirectory ~/mount/iso`; suCmd="kdesudo"; command -v kdesudo >/dev/null 2>&1 || { suCmd="kdesu" >&2; }; `echo $suCmd` -c "mount -o loop -t iso9660 \""%u\"" \""$mntDir\"""; `dolphin "$mntDir"`; Icon=media-optical Name=Mount iso Name[it]=Monta immagine Name[en]=Mount iso image [Desktop Entry] Actions=mountiso Icon=media-optical X-KDE-ServiceTypes=KonqPopupMenu/Plugin,application/x-cd-image/.* Type=Service
P.S. A more elaborate tool which allows mounting, unmounting and checking of ISO files can be found here http://kde-apps.org/content/show.php/MountISO?content=11577 It still runs perfectly under Kubuntu 14.04...

sedric

Hello, In Debian, kdesu isn't in the $PATH. So my work-around is to add the following line at the begining of Exec : PATH=$PATH:/usr/lib/kde4/libexec/ ; Not sure if it's portable, I don't use other distro as desktop.

falsobuio

when trying to mount an OS installer: This disc contains a "UDF" file system and requires an operating system that supports the ISO-13346 "UDF" file system specification. How can you bypass this?

Jtalk

Script does not work for paths with spaces. Enclosing %u and mntDir in single quotes must solve the issue. Something like: `echo $suCmd` -c "mount -o loop -t iso9660 '$fileName' '$mntDir'"

ptwales

Confirmed that this is a problem. It will not mount or give any errors when trying to mount an ISO with Spaces in the filename. Should it be double quotes though? Single quotes would be literal.

virgolus

Thx, I've correct it.

march84

is it not possible to make it rely on policykit instead of kdesudo or gksu?

virgolus

I have modified mount command in this way: mntDir=`kdialog --getexistingdirectory ~/`; suCmd="kdesudo"; command -v kdesudo >/dev/null 2>&1 || { suCmd="kdesu" >&2; }; `echo $suCmd` -c "mount -o loop -t iso9660 %u $mntDir"; dolphin $mntDir; Read the initial note for changes. It's ok for you?

virgolus

I have modified mount command in this way: mntDir=`kdialog --getexistingdirectory ~/`; suCmd="kdesudo"; command -v kdesudo >/dev/null 2>&1 || { suCmd="kdesu" >&2; }; `echo $suCmd` -c "mount -o loop -t iso9660 %u $mntDir"; dolphin $mntDir; Read the initial note for changes. It's ok for you?

feder77

Hi! Nice idea! Some improvements: * Handle errors. * There's no need to ask for mounted directory when unmounting. * Support for OS without sudo configured [0] [0]= Using gksu instead of sudo. Ok, I know, we are using kde, not gnome, but I like gksu very much. Implementation: [Desktop Action mountiso] Exec=mntDir=`kdialog --getexistingdirectory ~/` && gksu -- mount -o loop -t iso9660 "%u" "$mntDir" && dolphin "$mntDir" || kdialog --error "Error mounting!" ... [Desktop Action umountiso] Exec=mntDir=`mount | grep iso | grep "%u" | sed 's/.* on \\(.*\\) type iso9660.*/\\1/' | perl -e '$matches = 1; while (<STDIN>) { print "$_"; if (!($_ =~ /^$/)) { $matches = 0 } }; exit $matches;'` && ( gksu -- umount "$mntDir" && kdialog --passivepopup "Unmounted!" || kdialog --error "Error unmounting!" ) || kdialog --error "Not mounted!" Cheers!

janet

Alas all this does not work for me when I replace gksu with kdesu. And I don't want to use sudo. Therefore I now use a very simple servicemenu with the following two commands: For mounting in a fixed directory (which must exist): Exec=kdesu -c 'mount -o loop -t iso9660 %f /mnt/iso' and for umounting: Exec=kdesu -c 'umount %f' This works but does not give any feedback. I tried to append ; dolphin /mnt/iso to the mount command and ; kdialog --passivepopup "Unmounted!" to the unmount command (and both variants with && instead of the semicolon) but in all cases I then don't get any password dialog and the actions fail.

whererun

kde 4.8 kernel 3.2.6

whererun

fedora 16 x64

virgolus

The command launched is this: mntDir=$(kdialog --getexistingdirectory ~/) && echo $(kdialog --password "insert root password") | sudo -S mount -o loop -t iso9660 %u $mntDir; dolphin $mntDir; Now: 1) try to type in console this command: kdialog --getexistingdirectory ~/ 2) if the previous command open a directory selection window try to launch this command: (replace ~/Desktop/isotomount.iso with the path of iso to mount) mntDir=$(kdialog --getexistingdirectory ~/) && echo $(kdialog --password "insert root password") | sudo -S mount -o loop -t iso9660 ~/Desktop/isotomount.iso $mntDir; dolphin $mntDir;

Pling
0 Affiliates
Details
license
version 1.0
updated
added
downloads 24h 19
mediaviews 24h 0
pageviews 24h 3

Other Dolphin Service Menus:

burnWithGrowisofs
chunkylover
last update date: 20 years ago

Score 5.0

Firefox-bookmarks service menu
storyteller
last update date: 20 years ago

Score 5.0

Text Convert Service Menu
smp-penguin
last update date: 21 years ago

Score 5.0

Pdflatex servicemenu
bobuse
last update date: 20 years ago

Score 5.0

Send through Bluetooth
dmnet
last update date: 21 years ago

Score 5.0

Add to Bloglines
spookster
last update date: 20 years ago

Score 5.0



System Tags