#!/bin/sh
#
# $Id: mr-mount-me 3706 2018-04-12 23:27:58Z 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 | awk '{print $2}' | sort`
> $mountlist.sorted
for i in $paths ; do
    grep " $i " $mountlist >> $mountlist.sorted
done
mr-mount-subroutine-me < $mountlist.sorted
res=$?
mount -o bind /proc /mnt/RESTORING/proc
mount -o bind /sys /mnt/RESTORING/sys
exit $res
