#!/bin/sh # part of the gn*nix conspiracy http://gnnix.org # Copyright (C) Linus Sphinx 2004 # only god can make a tree but you can mount one # # usage: gnxmount gnxumountall() { cd / mnt=${1:-"/mnt/root"} inf=${2:-"/tmp/fstab"} for num in 9 8 7 6 5 4 3 2 1 0 do grep -v -E '^#+' $inf | grep -E '^\/dev\/' | grep -E 'ext2|ext3|xfs|reiserfs|jfs' \ | while read i do set $i dv=$1 pt=$2 tp=$3 lv=`echo $pt | sed 's/\// /g' | wc -w` lvl=${lv##* } if [ "$num" = "$lvl" ]; then umount ${dv} if [ "$?" != "0" ]; then echo "umount ${dv} failed!" >> /tmp/log fi fi done done } gnxumountall $1 $2