#!/bin/sh
#
# VMTux.net
#
# /usr/sbin/vmt-fsck
#
. /etc/vmt/vmt-colors
. /etc/vmt/vmt-conf

if [ "$(id -u)" -ne 0 ]; then echo "${BRed}Please run as root.${Reset}" ; exit 1; fi

if [ -z "$1" ]; then
  echo
  echo "Usage: $0 <device>"
  echo
  exit 1
fi

PATH=/bin:/sbin

umask 022

sync
sync
/etc/init.d/mdev.init stop
swapoff -a 2>/dev/null
killall5 
sleep 2
killall5

find ${VMT_LOOP} -maxdepth 1 -type d -exec umount -d {} \; 2>/dev/null;

umount $1

fsck -V $1

echo "it is a good time to reboot now"
#reboot

exit 0