Page 4 of 7 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 67

Thread: [SCRIPT] Easily (un)mounting ISO images without sudo

  1. #31
    Join Date
    Feb 2007
    Location
    Tri-Cities TN
    Beans
    24
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    I noticed one thing about the exported actions I attached above: they saved the absolute path to the scripts from my work system, so when I imported them onto my laptop at home, I had to change the paths. Just watch for that if anyone decided to import my actions.

  2. #32
    Join Date
    May 2008
    Beans
    3

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    Hum... Both scripts work, but aren't they the same?
    There is still no desktop icon for me...

  3. #33
    Join Date
    May 2008
    Beans
    3

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    I forget to ask: how do I make FIFA believe the mounted ISO is a false "real" CD ? (I hope you understood me xD)

  4. #34
    Join Date
    Jul 2007
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    Hum... Both scripts work, but aren't they the same?
    Both are the same, but the hardy version contains some small addition.

    There is still no desktop icon for me...
    Have you set the nautilus to show the desktop (in gconf-editor) ?
    Usually the default Ubuntu comes with this value set to checked, but checked it for sure tho.
    Open gconf-editor and navigate to:
    Code:
    apps -> nautilus -> preferences -> show_desktop = checked (true)
    make sure that show_desktop is checked.

    I forget to ask: how do I make FIFA believe the mounted ISO is a false "real" CD ? (I hope you understood me xD)
    Well, I don't know how, but usually people use the so-called NO-CD hack/crack, which can by pass the CD check thingy.
    Mount ISO/MDF/NRG with right-click to your desktop

    Do NOT do or even type "sudo rm -rf anything" or "rm -rf anything", if you're not sure what it'll do.

  5. #35
    Join Date
    May 2008
    Beans
    11

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    This is my first post in this forum...

    I'm running Kubuntu Hardy. Not a experienced user: I dual-booted for a year with Feisty, and finally decided to switch to Kubuntu-only (well, with some virtualization of XP 'needed' applications...). A lot to learn.

    I followed post #14 to install in kubuntu. Fuseiso already in default installation, my user a member of fuse... Changed fusemounter and tpl to .fusemounter dir, and changed the scripts:
    In .fusemounter/fusemounter changed
    Code:
    ...
    browser="dolphin"
    ...
    tpldesktopfile="/home/$whoami/.fusemounter/tpl"
    ...
    In .fusemounter/tpl I pasted the code suggested in #14.

    When I select mount ISO in context menu, it shows the 'jumping icon', but nothing happens, no desktop icon created. And when I browse to /tmp/fusemounter-user/, there's no file or directory.

    I'm doing something wrong, for sure, but I couldn't discover what...

  6. #36
    Join Date
    Jul 2007
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    Hi digitall.doc,

    for Hardy version, you have to modify the fusemounter/tpl file to something
    like this (the bold part):

    Code:
    [Desktop Action Unmount]
    Exec=$HOME/.fusemounter/fusemounter unmount path.to.iso
    Name=Unmount
    Icon=cdtrack
    
    [Desktop Entry]
    Actions=Unmount
    Encoding=UTF-8
    Version=1.0
    Type=Link
    URL=file://url.to.tmp
    Name=iso.name
    Icon=cdimage
    PathToIso=path.to.iso
    Also makes sure to have these packages installed:
    fuseiso & zenity .

    Please note that fuseiso9660 is different with fuseiso.
    Mount ISO/MDF/NRG with right-click to your desktop

    Do NOT do or even type "sudo rm -rf anything" or "rm -rf anything", if you're not sure what it'll do.

  7. #37
    Join Date
    May 2008
    Beans
    11

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    Thanks for your help.
    Now I managed to mount iso in /tmp. I'm afraid fuseiso wasn't installed (I would have sweared it was...).

    But I doesn't get a desktop icon yet.
    I modified tpl the way you advised, and tried again with #!/bin/bash version (...just in case), but with no success.
    In file associations I already added to x-iso mount and unmount.

    There's another difference between your code and that of #!/bin/bash: your command is mount %d/%f, and #!/bin/bash is mount %U. I'm using this last one, and as it is mounting well, I guess is correct.
    What am I doing wrong now?.

  8. #38
    Join Date
    Jul 2007
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    Hi digitall.doc,

    which version of KDE are you using? The 3.5 or the 4.0 ?
    I've tried with the 3.5, and the icon showing properly on the desktop.
    But with 4.0, sometimes the icons indeed not showing, I have to refresh the desktop to get the icon shown. Also, the "Unmount ISO" don't seems to working with KDE 4.0.

    Some notes, if you're downloaded the Hardy version, you should modified the "tpl" file according to my advise -- for the "URL" section, if not, the ISO won't properly opened or unmounted at later time. (The "URL" part is slightly different with the Gutsy's version).

    Also, can you go to your "Desktop" folder from Konqueror or Dolphin? (The full path is /home/<yourname>/Desktop.) Are there any icons for the mounted ISO there?
    Mount ISO/MDF/NRG with right-click to your desktop

    Do NOT do or even type "sudo rm -rf anything" or "rm -rf anything", if you're not sure what it'll do.

  9. #39
    Join Date
    May 2008
    Beans
    11

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    Hi M&T&H,
    I'm using KDE 3.5

    Already modified tpl following your last code.

    When I mount an iso, I can't see the icon on Desktop ('Escritorio' in my spanish Kubuntu), neither when I browse to desktop folder.

    It does unmount well when I right click on iso file and select unmount iso.

    Will it be anything wrong in file associations cofiguration?.

    Thanx for your help.

  10. #40
    Join Date
    Jul 2007
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: [SCRIPT] Easily (un)mounting ISO images without sudo

    When I mount an iso, I can't see the icon on Desktop ('Escritorio' in my spanish Kubuntu), neither when I browse to desktop folder.
    Now, there's the problem is. LOL. Sorry, when making this script, I must be thinking that all users are using the English version of Ubuntu (I know it's stupid, my mistake, sorry).

    Here's the modified script for your language (Spanish):
    Code:
    #!/bin/bash
    #
    # FuseMounter
    # Mount ISO file to /tmp and open it with nautilus, and show the mounted
    # file to user's desktop, for conveniently opening / unmounting for later.
    #
    # Parameter(s): 
    # #1 : operation (mount,unmount,unmount-desktop,auto-remove)
    # #2 : full path to iso (includes the file name) or the desktop shortcut CREATED using this script
    #
    #
    # @author Sutanto Kurniawan (tanto@lugi.or.id) a.k.a. "Milk & Toast & Honey" from ubuntuforums.org
    # @version $Revision: 1.3 $
    #
    # Bug Reports & Ideas:
    # Please report if you find any, by posting it to http://ubuntuforums.org/showthread.php?t=704350
    #
    # Changelog:
    # 16/05/2008
    # - Compatible version for Hardy Heron (Gnome 2.22)
    #   It seems to open shortcut from desktop files, the URL must written in the form of
    #   file://<path> as of Gnome 2.22's Nautilus.
    # - Change the tpl file value for URL section.
    #
    # 08/03/2008
    # - Support for auto-delete (a.k.a. auto-remove) the desktop shortcut for unmounted iso.
    # - Change the tmppath structure, so there won't be any interfere if two or more user mounting
    #   the same ISO (with the same ISO's filename, of course).
    # - Change the tpl file structure, so it can adapt comply with the new tmppath structure.
    # - Small fix on the return values and grep format (based on "!/bin/bash" from ubuntuforums.org 
    #   recommendation).
    #
    # 22/02/2008
    # - Initial commit.
    
    title="Fuse Mounter"
    browser="nautilus"
    desktop_name="Escritorio"
    isopath=$2
    isoname=`basename "$2" 2> /dev/null`
    whoami=`whoami`
    tmppath="/tmp/fusemounter-$whoami/$isoname"
    tpldesktopfile="/home/$whoami/bin/nautilus-actions/fusemounter/tpl"
    
    # mkdir in /tmp and mount the iso to there
    mount_iso() {
        mkdir -p "$tmppath"
        if fuseiso "$isopath" "$tmppath"
        then
            return 0;
        else
            rmdir "$tmppath"
            return 1;
        fi
    }
    
    # Unmount & rm tmp dir, fusermount.desktop file (when right-clicked from the origin iso file)
    unmount_iso() {
        desktopfile="/home/$whoami/$desktop_name/$isoname.fusemounter.desktop"
        rm "$desktopfile"
    
        unmount_real
    }
    
    # Umount & rm tmp dir, fusermount.desktop file (when right-clicked from the desktop), and
    # removes the *.iso.desktop file.
    # Basically this function just "correcting" the required
    # variable used by unmount_real() , and simply calling the 
    # unmount_real() afterwards.
    unmount_iso_from_desktop() {
        desktopfile="$isopath"
    
    # $isopath now contained the *.iso.desktop file, read the template.
    # thanks to "#!/bin/bash" from ubuntuforums.org for this grep code :)
        isopath=$(grep PathToIso "$desktopfile" | sed "s/PathToIso=//")
    
        isoname=`basename "$isopath"`
        tmppath=$(grep URL "$desktopfile" | sed "s\\URL=file://\\\\")
        rm "$desktopfile"
    
        unmount_real
    }
    
    # Unmount & rm tmp dir
    unmount_real() {
        if !(test -d "$tmppath")
        then
            zenity --info --title "$title" --text "$isoname is not mounted."
        else
            if fusermount -u "$tmppath"
            then
                rmdir "$tmppath"
                zenity --info --title "$title" --text "$isoname Unmounted."
            fi
        fi
        return 0;
    }
    
    # Creates nice desktop shortcut that can be used for opening and unmounting.
    create_desktop_file() {
        sed "s\\iso.name\\$isoname\\" "$tpldesktopfile" \
            | sed "s\\path.to.iso\\$isopath\\" \
            | sed "s\\url.to.tmp\\$tmppath\\" \
            > "/home/$whoami/$desktop_name/$isoname.fusemounter.desktop"
    }
    
    # Auto-delete the unmounted desktop shortcut file (preferably call this when 
    # logon,e.g. put this on the auto-started in session config)
    autoremove_desktop_file() {
    # according fuseiso manual, we can get the info about 
    # the mounted fuseisos from ~/.mtab.fuseiso, but I don't know
    # how to convert ' ' (space) to \040 notation from ~/.mtab.fuseiso or
    # /etc/mtab, nor how to `grep`-ing `mount` output, so I made one 
    # temporary file from the `mount` command output
        mounted="/tmp/fusemounter.mounted"
        mount > $mounted
    
        for i in /home/$whoami/$desktop_name/*.fusemounter.desktop; do
            url=`grep 'URL' "$i" | sed "s\\URL=file://\\\\"`
            if !(grep -iq "$url" $mounted)
            then
                rm "$i"
            fi
        done
    
        rm $mounted
    }
    
    # Confirm whether the user wants to open the target dir or not
    conf_open() {
        if `zenity --question --title "$title" --no-wrap --text "$isoname Mounted. Open?\n\nNote: You can open later by double-clicking the icon on your desktop."`
        then
            exec $browser "$tmppath"
        fi
        return 0;
    }
    
    # main()
    case "${1:-}" in
        mount)
            if mount_iso; then
                create_desktop_file
                conf_open
            fi
            ;;
        unmount)
            unmount_iso
            ;;
        unmount-desktop)
            unmount_iso_from_desktop
            ;;
        auto-remove)
            autoremove_desktop_file
            ;;
        *)
            usage="Usage $0 {mount|unmount|unmount-desktop|auto-remove} /path/to/iso/file"
            zenity --info --title "$title" --text "$usage" &
            echo "$usage"
    esac
    
    exit 0
    Open your /home/<yourname>/.fusemounter/fusemounter file with "Text Editor", and replace the contents with the code above.
    Mount ISO/MDF/NRG with right-click to your desktop

    Do NOT do or even type "sudo rm -rf anything" or "rm -rf anything", if you're not sure what it'll do.

Page 4 of 7 FirstFirst ... 23456 ... LastLast

Tags for this Thread

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
  •