#!/bin/sh # -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*- prog=$( basename $0 .bash ) ROLE=base PREFIX=/usr/local . /usr/local/bin/usr_local_base.bash || exit 2 . ~/.bash_logout # these can hang unmounting partitions pkill dirmngr pkill bootlogd [ -x /var/local/bin/privacy_home_cleaner.bash ] && /var/local/bin/privacy_home_cleaner.bash [ -f ~/Makefile ] && grep -q ^stop: ~/Makefile && \ { cd ~ ; make stop || exit 2 ; } local_base_umount () { local mount cd /mnt mount=`mount` for file in linux* ; do echo $mount | grep -q " on /mnt/$file " || continue echo /mnt/$file umount -R /mnt/$file || exit 1 done # not l - a b f d n u x i j k o q w e h z for file in ? ; do echo $mount | grep -q " on /mnt/$file " || continue # echo /mnt/$file umount /mnt/$file || WARN $prog error umounting /mnt/$file done umount -a } local_base_umount || exit 3 # should be 0 NUM=`losetup -a |grep -c -v home` if [ $NUM -gt 0 ] ; then losetup -a |grep -v home echo losetup still mounted exit 5 fi sleep 10 umount -a -t ntfs-3g # should be 1 NUM=`ps ax | grep mount.ntfs-3g | grep -v grep | wc -l` if [ $NUM -ge 1 ] ; then ps ax | grep mount.ntfs-3g | grep -v grep ERROR mount.ntfs-3g still running exit 6 fi INFO Calling shutdown if [ $# -lt 1 ] ; then shutdown -r now else shutdown $* fi