# HG changeset patch # User Rob Landley # Date 1453087132 21600 # Node ID c8293b3ab81f31d5f82281cff58c6944b813bb42 # Parent 47fe4b7798136110cdbb65be3999cd673bf880e7 Teach chroot-splice to accept one or two arguments. (Control image now optional.) diff -r 47fe4b779813 -r c8293b3ab81f more/chroot-splice.sh --- a/more/chroot-splice.sh Sun Jan 17 11:41:47 2016 -0600 +++ b/more/chroot-splice.sh Sun Jan 17 21:18:52 2016 -0600 @@ -3,9 +3,9 @@ # 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 ] +if [ $# -ne 1 ] && [ $# -ne 2 ] then - echo "usage: $0 "'$ARCH $CONTROL_IMAGE' >&2 + echo "usage: $0 "'$ARCH [$CONTROL_IMAGE]' >&2 exit 1 fi @@ -13,7 +13,7 @@ for i in build/{root-filesystem,native-compiler}-"$1" "$2" do - if [ ! -e "$i" ] + if [ ! -z "$i" ] && [ ! -e "$i" ] then echo "No $i" >&2 exit 1 @@ -40,12 +40,15 @@ cp -lan "build/native-compiler-$1/." "$CHROOT" || exit 1 # splice in control image -if [ -d "$2" ] +if [ $# -eq 2 ] then - mount -o bind "$2" "$CHROOT/mnt" && - mount -o remount,ro "$CHROOT/mnt"|| exit 1 -else - mount -o loop "$2" "$CHROOT/mnt" || exit 1 + if [ -d "$2" ] + then + mount -o bind "$2" "$CHROOT/mnt" && + mount -o remount,ro "$CHROOT/mnt"|| exit 1 + else + mount -o loop "$2" "$CHROOT/mnt" || exit 1 + fi fi # Output some usage hints