Linux Shell Script to make CD/DVD Image mounting possible
Mounting Of CD/DVD images are hectic and complex command based. To make it simple here is a way :
Copy the Following code in a text editor and save it as mount.sh
Mount Script
Code:
#!/bin/bash
# mount
gksudo -k /bin/echo "Are You The Admin?"
BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .iso`
sudo mkdir "/media/$BASENAME"
zenity --info --title "ISO Mounter" --text "$BASENAME e $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
if sudo mount -o loop -t iso9660 $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS "/media/$BASENAME"
then
if zenity --question --title "ISO Mounter" --text "$BASENAME Successfully Mounted. Open Volume?"
then
nautilus /media/"$BASENAME" --no-desktop
fi
exit 0
else
sudo rmdir "/media/$BASENAME"
zenity --error --title "ISO Mounter" --text "Cannot mount $BASENAME!"
exit 1
fi
Re: Linux Shell Script to make CD/DVD Image mounting possible
Copy the Following code in a text editor and save it as unmount.sh
Unmount Script
Code:
#!/bin/bash
# unmount
gksudo -k /bin/echo "Are You The Admin?"
BASENAME=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS .iso`
sudo umount "/media/$BASENAME"
sudo rmdir "/media/$BASENAME"
zenity --info --text "Successfully unmounted /media/$BASENAME"
exit 0
Re: Linux Shell Script to make CD/DVD Image mounting possible
These codes are NAUTILUS SCRIPTS.
Now you need to change the permission of the mount.sh and unmount.sh files : Type in the following commands in terminal : One line at a time!
Code:
sudo chmod +x /home/username/Desktop/mount.sh
sudo chmod +x /home/username/Desktop/umount.sh
Now you need to copy them to actual nautilus scripts.
Code:
sudo mv /home/username/mount.sh ~/.gnome2/nautilus-scripts/
sudo mv /home/username/unmount.sh ~/.gnome2/nautilus-scripts/
Now Reboot you computer to see the change...
To check Right click on any CD/DVD image there will be two options :
Now mounting will be easy...! Just Right Click the image and select the action.