From 5eb176f4711f57dc2adf2f9804727c1571ae3bb8 Mon Sep 17 00:00:00 2001 From: Travis Willard Date: Sat, 15 Dec 2007 20:51:30 -0500 Subject: Renamed -c option to -r (for "root") and added -c option (for clean). The old -c option, which specified a 'chroot', has been renamed to -r, since most other scripts use -r for a different root. A new -c option is introduced, which cleans all files from ${chrootdir}/rw before beginning, thus ensuring a clean chroot. Signed-off-by: Travis Willard Signed-off-by: Aaron Griffin --- makechrootpkg | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'makechrootpkg') diff --git a/makechrootpkg b/makechrootpkg index 329def7..55daea9 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -12,6 +12,7 @@ FORCE="n" RUN="" MAKEPKG_ARGS="-Ss" WORKDIR=$PWD +clean_first="" chrootdir="$CHROOT_SHELL" @@ -19,7 +20,7 @@ APPNAME=$(basename "${0}") usage () { - echo "usage ${APPNAME} [-h] [-c CHROOT_SHELL] [--] [makepkg args]" + echo "usage ${APPNAME} [-h] [-c] [-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." @@ -29,6 +30,9 @@ 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" @@ -42,7 +46,8 @@ usage () while getopts ':c:h' arg; do case "${arg}" in - c) chrootdir="$OPTARG" ;; + r) chrootdir="$OPTARG" ;; + c) clean_first=1 ;; h|?) usage ;; *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; esac @@ -73,6 +78,7 @@ if [ ! -d "$chrootdir/root" ]; then usage fi +[ -d "$chrootdir/rw" -a "$clean_first" -eq "1" ] && rm -rf "$chrootdir/rw/" [ -d "$chrootdir/rw" ] || mkdir "$chrootdir/rw" [ -d "$chrootdir/union" ] || mkdir "$chrootdir/union" -- cgit v1.2.3-24-g4f1b