#! /bin/sh
#
# umountfs	Turn off swap and unmount all local filesystems.
#
# Version:      @(#)umountfs  2.85-17  06-Jul-2005  miquels@cistron.nl
#               Modified by Markus Nass <generalstone@gmx.net>
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022
TMPTIME=0

# Start extra functions before umount.
. /etc/default/umountfs

# Cleaning /tmp, /var/run and /var/lock.
. /etc/init.d/bootclean.sh; bootclean

echo -n "Deactivating swap... "
swapoff -a
echo "done."

# Umount all filesystems except the virtual ones.
echo -n "Unmounting local filesystems... "
grep -v $ROOTFS /etc/mtab > /tmp/mtab
mv  -f /tmp/mtab /etc/mtab
umount -tnoproc,noprocfs,nodevfs,nosysfs,nousbfs,nousbdevfs,nodevpts -d -a -r
echo "done."

: exit 0
