#!/bin/sh
#
# $Id: mr-mount-me 3542 2016-03-24 16:48:03Z bruno $
#

mountlist=/tmp/mountlist.txt

if [ "$#" -ne "0" ] ;then
    echo "mr-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
mr-mount-subroutine-me < $mountlist.sorted
exit $?
