Mercurial > hg > aboriginal
changeset 1839:c8293b3ab81f draft default tip
Teach chroot-splice to accept one or two arguments. (Control image now optional.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 17 Jan 2016 21:18:52 -0600 |
parents | 47fe4b779813 |
children | |
files | more/chroot-splice.sh |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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