1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/uml-postsetupfs Sun Mar 21 01:28:59 2010 +0100
1.3 @@ -0,0 +1,44 @@
1.4 +#!/bin/bash
1.5 +# Usage: uml-postsetupfs
1.6 +
1.7 +# Configuration:
1.8 +if [ -e userinstall-defaults-uml ]; then
1.9 + source userinstall-defaults-uml
1.10 +elif [ -e /etc/default/userinstall-uml ]; then
1.11 + source /etc/default/userinstall-uml
1.12 +else
1.13 + echo "No defaults found for userinstall (UML)."
1.14 + exit 1
1.15 +fi
1.16 +
1.17 +# Ensure that images have been set up.
1.18 +if [ ! -e $UMLROOT ]; then
1.19 + echo "No UML instances set up at $UMLROOT."
1.20 + exit 1
1.21 +fi
1.22 +
1.23 +export IMAGE=$UMLROOT/rootfs
1.24 +
1.25 +if [ ! -e $IMAGE ]; then
1.26 + echo "No image set up at $IMAGE."
1.27 + exit 1
1.28 +fi
1.29 +
1.30 +export IMAGEDIR=$UMLROOT/rootfsdir
1.31 +
1.32 +if [ ! -e $IMAGEDIR ]; then
1.33 + mkdir $IMAGEDIR
1.34 +fi
1.35 +
1.36 +echo "Accessing the image..."
1.37 +mount -o loop $IMAGE $IMAGEDIR || exit 1
1.38 +
1.39 +echo "Copying the filesystem into the image..."
1.40 +cp -a $PACKAGEROOT/* $IMAGEDIR
1.41 +
1.42 +echo "Initialising device files..."
1.43 +chroot $PACKAGEROOT /bin/bash -c 'mount -t proc proc /proc; cd /dev; MAKEDEV generic; umount /proc'
1.44 +
1.45 +echo "Unmounting the image..."
1.46 +umount $IMAGEDIR
1.47 +rmdir $IMAGEDIR