Page 1 of 10 123 ... LastLast
Results 1 to 10 of 94

Thread: HOWTO: Nautilus Script to mount .iso files

  1. #1
    Join Date
    Apr 2005
    Beans
    14

    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 12:59 PM. Reason: Improved mounting script

  2. #2
    manicka Guest

    Re: HOWTO: Nautilus Script to mount .iso files

    I have added these scripts to the Ubuntu Document Storage Facility

  3. #3
    Join Date
    Nov 2004
    Beans
    213

    Re: HOWTO: Nautilus Script to mount .iso files

    Great script man! Thank you for posting it!

  4. #4
    Join Date
    Aug 2005
    Location
    Oslo, Norway
    Beans
    225

    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.

  5. #5
    Join Date
    Oct 2005
    Location
    Louisville KY (USA)
    Beans
    179
    Distro
    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"

  6. #6
    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

  7. #7
    Join Date
    Jul 2005
    Beans
    55

    Re: HOWTO: Nautilus Script to mount .iso files

    great script! thanks

  8. #8
    Join Date
    Oct 2005
    Location
    Southeast Asia
    Beans
    Hidden!
    Distro
    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?

  9. #9
    Join Date
    Apr 2005
    Beans
    14

    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.

  10. #10
    Join Date
    Apr 2005
    Beans
    14

    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.

Page 1 of 10 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •