# HG changeset patch # User Rob Landley # Date 1289478993 21600 # Node ID 095c9652525e1a02bd43550878e3be9a8f22ddb2 # Parent ba8e5317049c879e88cffdc63a70943b40bb7c8f Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.) diff -r ba8e5317049c -r 095c9652525e more/chroot-splice.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/more/chroot-splice.sh Thu Nov 11 06:36:33 2010 -0600 @@ -0,0 +1,42 @@ +#!/bin/bash + +# Combine a root filesystem directory and a control image into an $ARCH-specific +# chroot containing native build control files, suitable for chrooting into. + +if [ $# -ne 2 ] +then + echo 'usage: ./control-in-chroot.sh $ARCH $CONTROL_IMAGE' >&2 + exit 1 +fi + +# Make sure prerequisites exist + +for i in "build/root-filesystem-$1" "build/control-images/$2" +do + if [ ! -d "$i" ] + then + echo "No $i" >&2 + exit 1 + fi +done + +# Zap old stuff (if any) + +if [ -e "build/chroot-$1-$2" ] +then + more/zapchroot.sh "build/chroot-$1-$2" && + rm -rf "build/chroot-$1-$2" || + exit 1 +fi + +# Copy root filesystem and splice in control image +cp -la "build/root-filesystem-$1" "build/chroot-$1-$2" && +cp -la "build/control-images/$2/." "build/chroot-$1-$2/mnt/." || + exit 1 + +# Tar it up + +# Output some usage hints + +echo "export CPUS=1 HOST=$1 && cd /home && /mnt/init" && +echo "sudo chroot build/chroot-$1-$2" "/sbin/init.sh" diff -r ba8e5317049c -r 095c9652525e more/control-in-chroot.sh --- a/more/control-in-chroot.sh Thu Nov 11 04:50:39 2010 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#!/bin/bash - -# Combine a control image and a root-filesystem image into an $ARCH-specific -# chroot containing native build control files in /mnt. - -if [ $# -ne 2 ] -then - echo 'usage: ./control-in-chroot.sh $ARCH $CONTROL_IMAGE' >&2 - exit 1 -fi - -# Zap old stuff (if any) - -rm -rf build/root-filesystem-"$1" build/chroot-"$1" && - -# Make sure the root filesystem is there for this $ARCH - -./root-filesystem.sh "$1" && - -# Build control image. - -mkdir -p build/host-temp && -rm -rf build/host-temp/"$2".hdc && -sources/native-builds/"$2".sh build/host-temp/"$2".hdc && - -# Combine the control image's files with the root filesystem and rename result. - -rm -rf build/control-in-chroot-"$1" build/root-filesystem-"$1"/mnt && -mv build/host-temp/"$2" build/root-filesystem-"$1"/mnt && -mv build/root-filesystem-"$1" build/control-in-chroot-"$1" && - -# Tar it up - -tar -cvj -f build/control-in-chroot-"$1".tar.bz2 -C build control-in-chroot-"$1" && - -# Output some usage hints - -echo "export CPUS=1 HOST=$1 && cd /home && /mnt/init" && -echo "sudo chroot build/control-in-chroot-"$1" /sbin/init.sh"