#!/bin/sh

mountlist=/tmp/mountlist.txt

if [ "$#" -ne "0" ] ;then
    echo "mount-me <no params>"
    echo "...mountlist is assumed to be at $mountlist"
    exit 1
fi

if [ ! -f "$mountlist" ] ; then
    echo "I cannot find the mountlist '$mountlist'. Aborting."
    exit 1
fi

paths=`grep -vE " raid |lvm lvm" $mountlist | tr -s ' ' ' ' | cut -d' ' -f2 | sort`
> $mountlist.sorted
for i in $paths ; do
    grep " $i " $mountlist >> $mountlist.sorted
done
mount-subroutine-me < $mountlist.sorted
exit $?
