~ubuntu-branches/ubuntu/lucid/ltspfs/lucid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# remove_fstab_entry
# place in /lib/udev

grep ${1} /etc/fstab | while read DEV MOUNTPOINT TYPE OPTIONS DUMP PASS; do
    umount -l ${DEV} 2>&1 >/dev/null
    rmdir ${MOUNTPOINT}
    if [ -S /tmp/.ltspfs-socket ]; then
	    /usr/bin/ssh -S /tmp/.ltspfs-socket server \
                     "/usr/sbin/ltspfsmounter $MOUNTPOINT remove"
    else
        # use \| as separator for sed because path uses /
        sed -i -e "\|${MOUNTPOINT}|d" /var/run/.delayed-mount
        # Check and see if the file's now empty.  If it is, remove it.
        if [ ! -s /var/run/.delayed-mount ]; then
            rm /var/run/.delayed-mount
        fi
    fi
done

sed -e "/^\/dev\/$1 /d" /etc/fstab >/tmp/fstab
cp /tmp/fstab /etc/
rm /tmp/fstab