xfce4-trigger-launcher examples/ideas
H.R. ter Veer
terveer at lycos.nl
Mon Jul 21 10:20:27 CEST 2003
Try using another parameter, to figure out what to mount where, or look in
fstab: my cdrom is mounted on /mnt/cdrom, my cdrw is mounted on /mnt/cdrw, my
floppy is mounted on /mnt/floppy:
use something like togglemount <mountpoint>
btw you can see if it is mounted using /etc/mtab.
---- my own togglemount ----
#!/bin/sh
sound=1
gui=1
if [ "x$1" == "x" ]; then
echo "usage: togglemount <mountpoint>"
exit
fi
if cat /etc/mtab|grep $1 >/dev/null; then
echo "unmounting $1..."
umount $1
if echo "$1"|grep cdrom >/dev/null; then
eject /dev/cdrom
fi
if mount|grep $1 >/dev/null; then
if [ $gui -gt 0 ]; then
xmessage -center -timeout 3 -default "okay" " $1 not unmounted! "
elif [ $sound -gt 0 ]; then
play /usr/share/sounds/error.wav
fi
else
if [ $gui -gt 0 ]; then
xmessage -center -timeout 3 -default "okay" " $1 unmounted "
elif [ $sound -gt 0 ]; then
play /usr/share/sounds/umount.wav
fi
fi
else
if cat /etc/fstab|grep $1 >/dev/null; then
echo "mounting $1..."
mount $1
if mount|grep $1 >/dev/null; then
if [ $gui -gt 0 ]; then
xmessage -center -timeout 3 -default "okay" " $1 mounted "
elif [ $sound -gt 0 ]; then
play /usr/share/sounds/mount.wav
fi
else
if [ $gui -gt 0 ]; then
xmessage -center -timeout 3 -default "okay" " $1 not mounted! "
elif [ $sound -gt 0 ]; then
play /usr/share/sounds/error.wav
fi
fi
else
echo "unknown mountpoint: $1."
fi
fi
echo "done."
---
On Monday 21 July 2003 03:31, Jan Eidtmann wrote:
> cd mount/-unmount button:
>
> #!/bin/sh
>
> if [ "$1" = "1" ]; then
> echo 1
> mount /cdrom &> /dev/null
>
> elif [ "$1" = "0" ]; then
> echo 0
> umount /cdrom &> /dev/null
>
> else
> STATUS=`cat /proc/mounts | grep cdrom`
> if [ "x$STATUS" = "x" ]; then
> echo 0
> else
> echo 1
> fi
> fi
>
> any suggestions on how to make this better? :-)
> it works for me...
--
-------------------------------------------------------------------------
The only thing that you can rely on
is that you can't rely on anything
don't go and sell your soul for self-esteem
don't be plasticine
------------------------------------------------www.placeboworld.co.uk---
More information about the Xfce
mailing list