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?
Re: HOWTO: Nautilus Script to mount .iso files
I have added these scripts to the Ubuntu Document Storage Facility
Re: HOWTO: Nautilus Script to mount .iso files
Great script man! Thank you for posting it!
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.
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
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
Re: HOWTO: Nautilus Script to mount .iso files
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?
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.
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.