Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old November 7th, 2005   #1
animacide
5 Cups of Ubuntu
 
Join Date: Apr 2005
Beans: 15
HOWTO: Nautilus Script to mount .iso files

I recently found a nautilus shell script on an older post to the forum that could mount .iso files, but it couldn't handle spaces in filenames or mount more than one file at once. After some struggle I've come up with these scripts which handle multiple concurrent mounts and filenames with spaces. You'll want to save these under ~/.gnome2/nautilus-scripts/ and make them executable:

Mount:
Code:
#!/bin/bash
#
# nautilus-mount-iso

gksudo -u root -k /bin/echo "got r00t?"

sudo mkdir /media/"$*"

if sudo mount -o loop -t iso9660 "$*" /media/"$*"
then
        if zenity --question --title "ISO Mounter" --text "$* Successfully Mounted.
        
        Open Volume?"
        then
                nautilus /media/"$*" --no-desktop
        fi
        exit 0
else
        sudo rmdir /media/"$*"
        zenity --error --title "ISO Mounter" --text "Cannot mount $*!"
        exit 1
fi
Unmount:
Code:
#!/bin/bash
#
for I in "$*"
do
foo=`gksudo -u root -k -m "enter your password for root terminal
access" /bin/echo "got r00t?"`

sudo umount "$I" && zenity --info --text "Successfully unmounted /media/$I/" && sudo rmdir "/media/$I/"
done
done
exit0
To use either one just right click on the .iso file and use scripts -> mount. Hope someone finds this useful. Does anyone know if there's a way to make nautilus just unmount by right clicking on the volume icon on the desktop and selecting unmount volume?

Last edited by animacide; December 22nd, 2005 at 07:59 AM.. Reason: Improved mounting script
animacide is offline   Reply With Quote
Old November 8th, 2005   #2
manicka
Guest
 
Beans: n/a
Re: HOWTO: Nautilus Script to mount .iso files

I have added these scripts to the Ubuntu Document Storage Facility
  Reply With Quote
Old November 12th, 2005   #3
Darrena
Gee! These Aren't Roasted!
 
Join Date: Nov 2004
Beans: 207
Re: HOWTO: Nautilus Script to mount .iso files

Great script man! Thank you for posting it!
Darrena is offline   Reply With Quote
Old November 13th, 2005   #4
magnusbb
Way Too Much Ubuntu
 
Join Date: Aug 2005
Location: Oslo, Norway
Beans: 225
Send a message via MSN to magnusbb
Re: HOWTO: Nautilus Script to mount .iso files

One problem with this script, is, that if it is not possible to mount the iso file, it still creates a directory in /media. And it is not deleted. This can lead to heavy "clutter" after a while.
magnusbb is offline   Reply With Quote
Old November 18th, 2005   #5
DaBruGo
Gee! These Aren't Roasted!
 
Join Date: Oct 2005
Location: Louisville KY (USA)
Beans: 179
Ubuntu Breezy 5.10
Re: HOWTO: Nautilus Script to mount .iso files

I am going to see if I can use this to get a LIVE USB setup working that we are trying in thread 71567



DAVE
__________________
( If you don't care who gets the credit ... great things can be accomplished. )
Setup Guide: "Installing Ubuntu on an external USB Drive"
Good Starter Book: "Linux Desktop Pocket Guide"
DaBruGo is offline   Reply With Quote
Old November 26th, 2005   #6
RattyMan
First Cup of Ubuntu
 
Join Date: Sep 2005
Beans: 1
Re: HOWTO: Nautilus Script to mount .iso files

This doesn't work with any ISO file that is outside your home directory, other than that, great script
RattyMan is offline   Reply With Quote
Old December 13th, 2005   #7
-DarkMind-
Just Give Me the Beans!
 
-DarkMind-'s Avatar
 
Join Date: Jul 2005
Beans: 53
Re: HOWTO: Nautilus Script to mount .iso files

great script! thanks
-DarkMind- is offline   Reply With Quote
Old December 14th, 2005   #8
domino
Way Too Much Ubuntu
 
domino's Avatar
 
Join Date: Oct 2005
Location: Southeast Asia
My beans are hidden!
Ubuntu 7.04 Feisty Fawn
Re: HOWTO: Nautilus Script to mount .iso files

Great little script! Is there a way to modify the ISO contents if locally mounted?

RattyMan, I can, and I can even mount an ISO stored in my ntfs partition. Do you have root enabled?
domino is offline   Reply With Quote
Old December 22nd, 2005   #9
animacide
5 Cups of Ubuntu
 
Join Date: Apr 2005
Beans: 15
Re: HOWTO: Nautilus Script to mount .iso files

Just wanted to let everyone know that I've updated the mounting script to be more error tolerant. Now if an error occurs it tells you and it cleans up after itself by removing the directory in media. I also borrowed an idea from another thread where Gandalf added optional nautilus open. Hope this helps. I may also try to convert this into a Nautilus Actions style script so it only shows up on the context menu of appropriate .iso files.
animacide is offline   Reply With Quote
Old December 22nd, 2005   #10
animacide
5 Cups of Ubuntu
 
Join Date: Apr 2005
Beans: 15
Re: HOWTO: Nautilus Script to mount .iso files

Quote:
Originally Posted by domino
Great little script! Is there a way to modify the ISO contents if locally mounted?
Unfortunately, I don't think the loopback device allows for this. I think you would have to copy the contents or extract it with fileroller, and then use mkisofs or nautilus' built in burning to make a new iso.
animacide is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:00 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry