[devmon 1.1.3] unmount ejected disc; clean unmounted #6 #7

This commit is contained in:
IgnorantGuru 2012-08-12 07:37:47 -06:00
parent 64a5350999
commit 4b501f6f60
2 changed files with 23 additions and 9 deletions

View File

@ -4,6 +4,7 @@
curlftpfs pass user:pass as option
allow email address as username
allow unmount ejected disc #6 #7
[devmon 1.1.3] unmount ejected disc; clean unmounted #6 #7
0.3.1 2012-07-25:
cifs,smbfs use guest option when no user specified
sshfs add port as option

View File

@ -15,7 +15,7 @@ defaultmountoptions="noexec,nosuid,nodev,noatime"
help()
{
cat << EOF
devmon version 1.1.2 (distributed with udevil)
devmon version 1.1.3 (distributed with udevil)
Automounts and unmounts optical and removable drives
Requires: udevil bash>=4 Also Recommended: eject zenity
Optional: udisks v1 may be substituted for udevil
@ -1084,20 +1084,32 @@ while ps -p $COPROC_PID &>/dev/null; do
eval notejected${devpath#/dev/}=1
else
if [ "$systeminternal" != "1" ] && \
[ "$ismounted" != "1" ] && [ "$hasmedia" = "0" ]; then
# disc ejected
echo "devmon: $devpath eject detected"
eval notejected${devpath#/dev/}=0
[ "$hasmedia" = "0" ]; then
if (( notejected == 1 )) || [ "$notejected" == "" ]; then
# disc ejected
echo "devmon: $devpath eject detected"
eval notejected${devpath#/dev/}=0
fi
if [ "$ismounted" != "0" ]; then
# unmount if ejected disc still mounted
unmountdev "$devpath"
fi
fi
if [ "$systeminternal" != "1" ] && [ "$ismounted" != "1" ] && \
[ "$nopolicy" != "1" ] && [ "$devmounted" = "1" ]; then
[ "$nopolicy" != "1" ] && [ "$devmounted" = "1" ]; then
# exec-on-unmount
if (( execoux != 0 )); then
if ( ! ignoredevice "$devpath" ) && ( ! ignorelabel "$label" ); then
if ( ! ignoredevice "$devpath" ) && \
( ! ignorelabel "$label" ); then
dv="$devpath"
execcommands "exec on unmount" "${execou[@]}"
fi
fi
# remove udevil mount point in case unmounted by other
if [ "$mount_cmd" = "$udevil" ]; then
echo "devmon: $udevil clean"
$udevil clean
fi
fi
fi
;;
@ -1112,12 +1124,13 @@ while ps -p $COPROC_PID &>/dev/null; do
mounterr=$?
fi
if [ $mounterr -eq 0 ]; then
unmountdev $devpath
unmountdev "${devpath}"
elif [ "$mount_cmd" = "$udevil" ]; then
# remove mount point of removed device which was unmounted by other
# remove udevil mount point in case unmounted by other
echo "devmon: $udevil clean"
$udevil clean
fi
# exec-on-remove
if (( execorx != 0 )); then
if ( ! ignoredevice "$devpath" ); then