123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #!/bin/sh
- [ ! $1 ] && exec busybox umount
- . /etc/rc.d/functions4puppy4
- MNTDDEVS1="`busybox mount | grep '^/dev/[smhf]' | cut -f 1 -d ' ' | cut -f 3 -d '/'`"
- DASHOPTS="`echo "$*" | tr '\t' ' ' | tr ' ' '\n' | grep '^\-'`"
- if [ ! "`echo " $DASHOPTS" | grep 'n'`" = "" ];then
- FULLCMD="`echo -n " $*" | sed -e 's/ \-n / /g'`"
- else
- FULLCMD="$*"
- fi
- if [ ! "`echo " $DASHOPTS" | grep 'a'`" = "" ];then
- MNTFUSE="`busybox mount | grep 'fuse' | head -n 1 | cut -f 3 -d ' '`"
- [ ! "$MNTFUSE" = "" ] && fusermount -u $MNTFUSE
- busybox umount -d $FULLCMD
- exit $?
- fi
- LASTPARAM="`echo -n "$*" | tr '\t' ' ' | tr -s ' ' | tr ' ' '\n' | grep '^/'`"
- NTFSMNTPT="`ps -e | grep -o 'ntfs\-3g.*' | grep "$LASTPARAM" | tr '\t' ' ' | tr -s ' ' | tr ' ' "\n" | grep '^/mnt/'`"
- if [ "$NTFSMNTPT" = "" ];then
- busybox umount -d $FULLCMD
- RETVAL=$?
- else
-
- fusermount -u $NTFSMNTPT
- RETVAL=$?
- fi
- if [ $RETVAL -eq 0 ];then
-
- MNTDDEVS2="`busybox mount | grep '^/dev/[smhf]' | cut -f 1 -d ' ' | cut -f 3 -d '/'`"
- if [ "$MNTDDEVS2" = "" ];then
- DEVNAME="`echo "$MNTDDEVS1" | head -n 1`"
- else
- DEVNAME="`echo "${MNTDDEVS1}
- ${MNTDDEVS2}" | sort | uniq -u | head -n 1`"
- fi
- if [ "$DEVNAME" != "" -a "$DISPLAY" != "" ];then
- DRVNAME="`echo -n "$DEVNAME" | cut -b 1-3`"
-
- [ "$DRVNAME" = "mmc" ] && DRVNAME="`echo -n "$DEVNAME" | sed -e 's/p[0-9]$//'`"
- xDRVNAME="$DRVNAME"
- [ -d /root/.pup_event/drive_${DEVNAME} ] && DRVNAME="$DEVNAME"
- if [ -d /root/.pup_event/drive_${DRVNAME} ];then
- case $DRVNAME in
- fd*)
- DRV_CATEGORY="floppy"
- ;;
- *)
- dnPATTERN='/dev/'"${xDRVNAME}"'|'
- DRV_CATEGORY="`probedisk | grep "$dnPATTERN" | cut -f 2 -d '|'`"
- ;;
- esac
-
- drvPATTERN='^/dev/'"${DRVNAME}"
-
- [ "$DRVNAME" != "$xDRVNAME" ] && drvPATTERN='^/dev/'"${DRVNAME}"' '
-
-
- if [ "`df | tr -s ' ' | cut -f 1,6 -d ' ' | grep "$drvPATTERN" | grep -v ' /initrd/' | grep -v ' /$'`" = "" ];then
- if [ "`df | tr -s ' ' | cut -f 1,6 -d ' ' | grep "$drvPATTERN" | grep -E ' /initrd/| /$'`" != "" ];then
-
- icon_mounted_func $DRVNAME $DRV_CATEGORY
- else
-
- icon_unmounted_func $DRVNAME $DRV_CATEGORY
- fi
- fi
- fi
- fi
- fi
- if [ ! -L /etc/mtab ];then
- rm -f /etc/mtab
- ln -s /proc/mounts /etc/mtab
- fi
- exit $RETVAL
|