These scripts will mount and unmount an .iso image for use in WINE and/or DOSBox under Ubuntu. Presumably it will work for other systems using Gnome2 and Nautilus.
First, make a directory that you will *always* mount images to for WINE and/or DOSBox. In a terminal window:
sudo mkdir /media/iso
Then do the following to create the script file:
cd ~/.gnome2/nautilus-scripts
gedit mount_iso
And cut and paste the following:
#!/bin/bashgksudo -u root -k /bin/echo "sudo password"
if sudo mount -o loop -t iso9660 "$*" /media/iso
then
if zenity --question --title "ISO Mounter" --text "$* Successfully Mounted.Open Volume?"
then
nautilus /media/iso --no-desktop
fi
exit 0
else
zenity --error --title "ISO Mounter" --text "Cannot mount $*!"
exit 1
fi
And save/close
Next, to unmount:
gedit unmount_iso
And copy/paste:
#!/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 /media/iso && zenity --info --text "Successfully unmounted $I"
done
done
exit0
Again, save/close.
Next make them executable:
chmod 777 ./*
Now, when you right-click on an .iso image file in Nautilus, you’ll see a “Scripts” option. Click “mount_iso” to mount, and “unmount_iso” to unmount. Yes, you must right click on the .iso file again to unmount it.
Open your WINE configuration, go to the Drives tab, if it’s not already present, Add… a new entry, call it drive D:, point it to /media/iso, and make its type CD-ROM.
Open your dosbox.conf file, and at the bottom for the autoexec.bat, add
MOUNT d /media/iso -t cdrom
This will mount that directory as a cd-rom every time you open DOSBox.
Now, this works fine for many older games that just need the disk present. It works for Starcraft, Privateer and TIE Fighter for example, but YMMV with other software.


3 Responses to “Nautilus Scripts to mount .iso images in Ubuntu”
Leave a Reply