
Simple mount Iso service menu
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
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"
6 years ago
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
6 years ago
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
xalalau
4 years ago
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]
Report
xalalau
4 years ago
sudo apt install kdesudo
Report
xalalau
4 years ago
Report
guoyunhe
4 years ago
Addon version 1.0, KDE 5.8.3, Dolphin 16.08.3
Report
noric
5 years ago
mount -o loop -t iso9660
to
mount -o loop -t auto
This way the scipt won't fail with udf file systems.
Report
GHPS
5 years ago
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...
Report
sedric
6 years ago
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.
Report
falsobuio
6 years ago
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?
Report
Jtalk
8 years ago
`echo $suCmd` -c "mount -o loop -t iso9660 '$fileName' '$mntDir'"
Report
virgolus
6 years ago
Report
ptwales
6 years ago
Should it be double quotes though? Single quotes would be literal.
Report
march84
8 years ago
Report
virgolus
8 years ago
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?
Report
virgolus
8 years ago
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?
Report
feder77
8 years ago
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!
Report
janet
8 years ago
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.
Report
whererun
8 years ago
kernel 3.2.6
Report
whererun
8 years ago
Report
virgolus
8 years ago
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;
Report