Update build-umlrootfs script to new log format

This commit is contained in:
Reto Buerki
2013-01-17 15:22:10 +01:00
committed by Tobias Brunner
parent 5828e434bd
commit bf3ff0e585
2 changed files with 29 additions and 59 deletions
-1
View File
@@ -54,7 +54,6 @@ fi
# #
if [ $ENABLE_BUILD_UMLROOTFS = "yes" ] if [ $ENABLE_BUILD_UMLROOTFS = "yes" ]
then then
cecho "Building uml base image (scripts/build-umlrootfs)"
$DIR/scripts/build-umlrootfs $DIR/scripts/build-umlrootfs
fi fi
+29 -58
View File
@@ -14,87 +14,58 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details. # for more details.
echo "Building root image"
DIR=`dirname $0` DIR=`dirname $0`
source $DIR/function.sh . $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found" [ `id -u` -eq 0 ] || die "You must be root to run $0"
source $DIR/../testing.conf [ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
cecho-n " * Looking for root image at '$ROOTFS'.." [ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
if [ -f "$ROOTFS" ]
then
cgecho "found it"
else
cecho "none"
exit
fi
[ -d $BUILDDIR ] || die "!! Directory '$BUILDDIR' does not exist"
ROOTFSDIR=$BUILDDIR/root-fs ROOTFSDIR=$BUILDDIR/root-fs
mkdir -p $ROOTFSDIR
if [ ! -d $ROOTFSDIR ] mkdir -p $LOOPDIR
then mkdir -p $ROOTFSCOMPILEDIR
cecho-n " * Root file system directory '$ROOTFSDIR' does not exist..creating.."
mkdir $ROOTFSDIR
cgecho "done"
fi
cd $ROOTFSDIR cd $ROOTFSDIR
if [ ! -d $LOOPDIR ]
then
mkdir $LOOPDIR
fi
######################################################
# mount root image
#
BASE=$BUILDDIR/base.img BASE=$BUILDDIR/base.img
cecho-n " * Mounting base image $BASE.." log_action "Creating $BASE"
cp $ROOTFS $BASE execute "cp $ROOTFS $BASE"
mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1
mount -t proc none $LOOPDIR/proc >> $LOGFILE 2>&1 log_action "Mounting base image $BASE"
cgecho "done" execute "mount -o loop $BASE $LOOPDIR"
log_action "Mounting proc filesystem to $LOOPDIR/proc"
execute "mount -t proc none $LOOPDIR/proc"
######################################################
# install software from source using 'recipes'
#
mkdir -p $ROOTFSCOMPILEDIR
cecho " * Mounting $ROOTFSCOMPILEDIR as /root/compile.."
mkdir -p $LOOPDIR/root/compile mkdir -p $LOOPDIR/root/compile
mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile >> $LOGFILE 2>&1 log_action "Mounting $ROOTFSCOMPILEDIR as /root/compile"
execute "mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile"
cecho " * Installing software from source.." echo "Installing software from source"
RECPDIR=$UMLTESTDIR/testing/scripts/recipes RECPDIR=$UMLTESTDIR/testing/scripts/recipes
RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename` RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename`
cp -r $RECPDIR/patches $LOOPDIR/root/compile execute "cp -r $RECPDIR/patches $LOOPDIR/root/compile" 0
for r in $RECIPES for r in $RECIPES
do do
cecho-n " - $r.."
cp $RECPDIR/$r ${LOOPDIR}/root/compile cp $RECPDIR/$r ${LOOPDIR}/root/compile
chroot ${LOOPDIR} make SWANVERSION=$SWANVERSION -C /root/compile -f $r \ log_action "Installing from recipe $r"
>> $LOGFILE 2>&1 execute_chroot "make SWANVERSION=$SWANVERSION -C /root/compile -f $r"
if [ $? != 0 ]; then
cecho "failed"
else
cgecho "done"
fi
done done
umount $LOOPDIR/root/compile umount $LOOPDIR/root/compile
cecho " * Setting up shared build tree at /root/compile" log_action "Setting up shared build tree at /root/compile"
echo "" >> $LOOPDIR/etc/fstab echo "" >> $LOOPDIR/etc/fstab
echo "none /root/compile hostfs $ROOTFSCOMPILEDIR" >> $LOOPDIR/etc/fstab echo "none /root/compile hostfs $ROOTFSCOMPILEDIR" >> $LOOPDIR/etc/fstab
log_status 0
###################################################### log_action "Removing /etc/resolv.conf"
# remove /etc/resolv.conf execute "rm -f $LOOPDIR/etc/resolv.conf"
#
cecho " * Removing /etc/resolv.conf"
rm -f $LOOPDIR/etc/resolv.conf
umount $LOOPDIR/proc execute "umount $LOOPDIR/proc" 0
umount $LOOPDIR execute "umount $LOOPDIR" 0