summaryrefslogtreecommitdiff
path: root/makechrootpkg
diff options
context:
space:
mode:
authorTravis Willard <travis@archlinux.org>2007-12-15 20:51:30 -0500
committerAaron Griffin <aaronmgriffin@gmail.com>2008-01-23 16:11:37 -0600
commit5eb176f4711f57dc2adf2f9804727c1571ae3bb8 (patch)
treefc09f3951dae5d1d51d3f308e718479564bbf9cb /makechrootpkg
parent59d373a62b759c5096ecd090eff48c349d71dece (diff)
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 <travis@archlinux.org> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'makechrootpkg')
-rwxr-xr-xmakechrootpkg10
1 files changed, 8 insertions, 2 deletions
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"