#! /bin/sh
#
# umountfs	Turn off swap and unmount all local file systems.
#
# Version:      @(#)umountfs  2.85-16  03-Jun-2004  miquels@cistron.nl
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

echo -n "Deactivating swap..."
umount -ttmpfs -a -r
swapoff -a
echo "done."

USING=1
grep -e '/dev/mtdblock3 / yaffs2' /proc/mounts > /dev/null 2>&1
if [ "$?" -eq 0 ]; then USING=2
fi

#
#	Umount all filesystems except the virtual ones.
#
echo -n "Unmounting local filesystems..."
umount -tnoproc,noprocfs,nodevfs,nosysfs,nousbfs,nousbdevfs,nodevpts -d -a -r
echo "done."

# This is superfluous.
#mount -n -o remount,ro /

if [ "$USING" -eq 1 ]; then
  mount -n -o remount,ro /dev/tssdcardb4 /
else
  mount -n -o remount,ro /dev/mtdblock3 /
fi

: exit 0
