#
# DESCRIPTION:
#
#    prepare a root-filesystem under $ROOTPATH, 
#    use aufs for a writable overlay filesystem
#
# part of the LiveBackup project:  
#
#                     http://livebackup.sourceforge.net/
#
# Copyright 2006 by Wolfgang Rohrmoser <info@rohrmoser-engineering.de>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#


# detect media and mount backup image 
execute netconf
execute mount_nfs
execute netload
execute mount_media
execute drive_settings
execute search_image
execute verify_image
execute copy2ram
execute mount_image
execute mount_nested_image

# create writable filesystem layer
execute mount_rwdisk $OVERLAY_MNT $LB_METHOD_OPT

# mount the union
msg -i "using aufs to make system image writable"

mount -n -t aufs -o dirs=$OVERLAY_MNT=rw:$IMAGE_MNT=ro none $ROOTPATH

#
# hint: do not provide /sbin/mount.aufs! It will require a writable /etc
#       directory to update /etc/mtab. /etc is not writable yet !!
#

if [ ! "$(grep aufs /proc/mounts)" ]; then
    rescue_shell "!!mount failed!!!"  
fi


#
# Local Variables: 
# mode: shell-script
# End: 
#



