Simple mount Iso service menu
Dolphin Service Menus
Score 60%
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:

3 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

1 year ago

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]

Report

xalalau

1 year ago

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

Report

xalalau

1 year ago

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

sudo apt install kdesudo

Report

guoyunhe

1 year ago

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

Report

noric

2 years ago

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.

Report

GHPS

2 years ago

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...

Report

sedric

3 years ago

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.

Report

falsobuio

3 years ago

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?

Report

Jtalk

5 years ago

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'"

Report

ptwales

3 years ago

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.

Report

C

virgolus

3 years ago

Thx, I've correct it.

Report

march84

5 years ago

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

Report

C

virgolus

5 years ago

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?

Report

C

virgolus

5 years ago

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?

Report

feder77

5 years ago

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!

Report

janet

5 years ago

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.

Report

whererun

6 years ago

kde 4.8
kernel 3.2.6

Report

whererun

6 years ago

fedora 16 x64

Report

C

virgolus

6 years ago

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;

Report

3 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

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
1.0
updated Mar 20 2014
added Feb 12 2012
downloads today
0
page views today 5