diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-02-23 14:30:28 -0800 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-02-23 14:30:28 -0800 |
commit | dd45bbcaf3dc9500613a595f63c0fa8b54ab0098 (patch) | |
tree | d48b1647101ebd9e236d05425ad1d58ed8cb6f4d | |
parent | c67729af9860d925f2b8fe91e73fad3218c74fb2 (diff) | |
download | devtools32-dd45bbcaf3dc9500613a595f63c0fa8b54ab0098.tar.xz |
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 <aaronmgriffin@gmail.com>
-rwxr-xr-x | makechrootpkg | 22 |
1 files changed, 17 insertions, 5 deletions
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 <pkg> 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" |