]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Update build-umlrootfs script to new log format
authorReto Buerki <reet@codelabs.ch>
Thu, 6 Dec 2012 16:32:44 +0000 (17:32 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 17 Jan 2013 14:22:10 +0000 (15:22 +0100)
testing/make-testing
testing/scripts/build-umlrootfs

index b5e65d3093c9f620e020ec7a6ce62e421551c968..89a3db1a1e3cc2405533f56d98fd65b4396254c2 100755 (executable)
@@ -54,7 +54,6 @@ fi
 #
 if [ $ENABLE_BUILD_UMLROOTFS = "yes" ]
 then
-   cecho "Building uml base image (scripts/build-umlrootfs)"
    $DIR/scripts/build-umlrootfs
 fi
 
index 5a885ce4adef8b3d391c283f95235c3d9ab4eed8..a0444de38508d2d96943db681c26fc1f153483ec 100755 (executable)
 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 # for more details.
 
-DIR=`dirname $0`
+echo "Building root image"
 
-source $DIR/function.sh
+DIR=`dirname $0`
 
-[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found"
+. $DIR/function.sh
 
-source $DIR/../testing.conf
+[ `id -u` -eq 0 ] || die "You must be root to run $0"
 
-cecho-n " * Looking for root image at '$ROOTFS'.."
-if [ -f "$ROOTFS" ]
-then
-    cgecho "found it"
-else
-    cecho "none"
-    exit
-fi
+[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
+. $DIR/../testing.conf
 
-[ -d $BUILDDIR ] || die "!! Directory '$BUILDDIR' does not exist"
+[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
 
 ROOTFSDIR=$BUILDDIR/root-fs
-
-if [ ! -d $ROOTFSDIR ]
-then
-    cecho-n " * Root file system directory '$ROOTFSDIR' does not exist..creating.."
-    mkdir $ROOTFSDIR
-    cgecho "done"
-fi
-
+mkdir -p $ROOTFSDIR
+mkdir -p $LOOPDIR
+mkdir -p $ROOTFSCOMPILEDIR
 cd $ROOTFSDIR
 
-if [ ! -d $LOOPDIR ]
-then
-    mkdir $LOOPDIR
-fi
-
-######################################################
-# mount root image
-#
 BASE=$BUILDDIR/base.img
-cecho-n " * Mounting base image $BASE.."
-cp $ROOTFS $BASE
-mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1
-mount -t proc none $LOOPDIR/proc >> $LOGFILE 2>&1
-cgecho "done"
+log_action "Creating $BASE"
+execute "cp $ROOTFS $BASE"
+
+log_action "Mounting base image $BASE"
+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
-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
 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
 do
-       cecho-n "   - $r.."
        cp $RECPDIR/$r ${LOOPDIR}/root/compile
-       chroot ${LOOPDIR} make SWANVERSION=$SWANVERSION -C /root/compile -f $r \
-               >> $LOGFILE 2>&1
-       if [ $? != 0 ]; then
-               cecho "failed"
-       else
-               cgecho "done"
-       fi
+       log_action "Installing from recipe $r"
+       execute_chroot "make SWANVERSION=$SWANVERSION -C /root/compile -f $r"
 done
 
 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 "none /root/compile hostfs $ROOTFSCOMPILEDIR" >> $LOOPDIR/etc/fstab
+log_status 0
 
-######################################################
-# remove /etc/resolv.conf
-#
-cecho " * Removing /etc/resolv.conf"
-rm -f $LOOPDIR/etc/resolv.conf
+log_action "Removing /etc/resolv.conf"
+execute "rm -f $LOOPDIR/etc/resolv.conf"
 
-umount $LOOPDIR/proc
-umount $LOOPDIR
+execute "umount $LOOPDIR/proc" 0
+execute "umount $LOOPDIR" 0