
Simple mount Iso service menu
Source (link to git-repo or to original if based on someone elses unmodified work):
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:
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"
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
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]
Ops... Remove all the "[quote][/quote]" before using this script, please.
Ops 2... Don't forget to install kdesudo: sudo apt install kdesudo
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
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.
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...
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.
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?
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'"
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.
Thx, I've correct it.
is it not possible to make it rely on policykit instead of kdesudo or gksu?
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?
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?
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!
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.
kde 4.8 kernel 3.2.6
fedora 16 x64
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;