From dd45bbcaf3dc9500613a595f63c0fa8b54ab0098 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Mon, 23 Feb 2009 14:30:28 -0800 Subject: Add 'update first' flag and fix help Add -u to update the chroot before building. This should update the unionfs rw layer only, leaving the chroot clean. Useful for rebuilds and a local repo. Also fix the docs and document the -i flag Signed-off-by: Aaron Griffin --- makechrootpkg | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'makechrootpkg') diff --git a/makechrootpkg b/makechrootpkg index c335f69..8fa720d 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -13,6 +13,7 @@ RUN="" MAKEPKG_ARGS="-sr" REPACK="" WORKDIR=$PWD +update_first="0" clean_first="0" install_pkg="" @@ -22,7 +23,7 @@ APPNAME=$(basename "${0}") usage () { - echo "usage ${APPNAME} [-h] [-c] [-r CHROOT_SHELL] [--] [makepkg args]" + echo "usage ${APPNAME} [-hcui] [-r CHROOT_SHELL] [--] [makepkg args]" echo " Run this script in a PKGBUILD dir to build a package inside a" echo " clean chroot. All unrecognized arguments passed to this script" echo " will be passed to makepkg." @@ -32,9 +33,6 @@ usage () echo " directories: \$CHROOT_SHELL/{root, rw, union} but only 'root' is" echo " required by default. The rest will be created as needed" echo "" - echo "The -c flag, if specified, will remove all files created by previous" - echo "builds using makechrootpkg. This will ensure a clean chroot is used." - echo "" echo "The chroot shell 'root' directory must be created via the following" echo "command:" echo " mkarchroot \$CHROOT_SHELL/root base base-devel sudo" @@ -43,13 +41,22 @@ usage () echo "options, put -- between the makechrootpkg args and the makepkg args" echo "" echo "Default makepkg args: $MAKEPKG_ARGS" + echo "" + echo "Flags:" + echo "-h This help" + echo "-c Clean the chroot before building" + echo "-u Update the rw layer of the chroot before building" + echo " This is useful for rebuilds without dirtying the pristine" + echo " chroot" + echo "-i Install a package into the rw layer of the chroot" exit 1 } -while getopts ':r:i:h:c' arg; do +while getopts ':r:i:h:cu' arg; do case "${arg}" in r) chrootdir="$OPTARG" ;; i) install_pkg="$OPTARG" ;; + u) update_first=1 ;; c) clean_first=1 ;; h|?) usage ;; *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; @@ -127,6 +134,11 @@ if [ -n "$install_pkg" ]; then exit $ret fi +if [ $update_first -eq 1 ]; then + echo "updating chroot" + mkarchroot -u "$uniondir" +fi + echo "moving build files to chroot" [ -d "$uniondir/build" ] || mkdir "$uniondir/build" -- cgit v1.2.3-24-g4f1b