LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author] [stats]
  From: Damien Uern <carrigan_2606@optusnet.com.au>
  To  : Linux SA <linuxsa@linuxsa.org.au>
  Date: Sun, 13 Apr 2003 12:36:58 +0930

Mounting .iso images with konqueror

Hi,

Just made a nice script, thought I'd share it with you. This script and 
servicemenu allow you to rightclick an ISO image and mount it to a directory. 
Unfortunately you have to drop to a root terminal to umount it. Also, the 
script does not ask for a password, so you need to be running konqueror as 
root (easy enough with alt-f2 run as root, etc).

Anyway, you need to copy this file (call it mountiso.desktop) to 
/usr/share/apps/konqueror/servicemenus (on Mandrake 9.1 at least, it depends 
where KDE is installed).

#############<CUT>################
[Desktop Entry]
Actions=MountCDImage
Encoding=UTF-8
ServiceTypes=application/x-iso

[Desktop Action MountCDImage]
Exec=mountiso.sh %u
Name=Mount ISO Image
#############</CUT>################

And you need the accompanying bash script (which even has nice friendly 
dialogs that ask you where to mount it :) Save this file to somewhere in your 
path, call it mountiso.sh.

#############<CUT>################
#! /usr/bin/env bash

mountdir=`kdialog --inputbox "Enter directory name to mount iso to"`;

if [[ ! -e "$mountdir" ]]; then
 kdialog --yesno "Directory does not exist, create it?" && mkdir "$mountdir";
 if [[ ! -e "$mountdir" ]]; then
   echo "Cannot mount iso image.";
   exit 1;
 fi
fi

mount -t iso9660 -o loop "$1" "$mountdir";
#############</CUT>################

I'm sure more experienced people could rewrite that bash script so that it 
asks for password if not root, etc etc. But I'm pretty inexperienced at shell 
scripting. I will gladly accept people's modifications :) Oh it should 
probably check to make sure they're not mounting the image to / (or somewhere 
equally important) :)

Damien

-- 
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.freenode.net
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author] [stats]
Return to the LinuxSA Mailing List Information Page