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.
Bookmarks