| 1 |
#!/bin/bash |
| 2 |
# umountavfs -- program to unmount avfs file system |
| 3 |
# and unload avfsd daemon. |
| 4 |
# companion program to mountavfs |
| 5 |
# will check to see if avfsd is mounted and then |
| 6 |
# unmount using fusermount. |
| 7 |
|
| 8 |
# suggested use: in a logout script or wm exit routine |
| 9 |
|
| 10 |
# if unset or not pointing to a directory, revert to default mount point |
| 11 |
if [ ! -d "$AVFSBASE" ]; then |
| 12 |
AVFSBASE="${HOME}/.avfs" |
| 13 |
fi |
| 14 |
|
| 15 |
grep -qE "avfsd ${AVFSBASE}" /proc/mounts && { |
| 16 |
echo unMounting AVFS on $AVFSBASE... |
| 17 |
if type -p fusermount > /dev/null 2>&1 ; then |
| 18 |
fusermount -u -z "$AVFSBASE" |
| 19 |
else |
| 20 |
umount -l "$AVFSBASE" |
| 21 |
fi |
| 22 |
|
| •23 |
# Remove directory again |
| 24 |
rmdir ${AVFSBASE} |
| 25 |
|
| 26 |
unset AVFSBASE |
| 27 |
} |