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>
This commit is contained in:
parent
59d373a62b
commit
5eb176f471
|
@ -12,6 +12,7 @@ FORCE="n"
|
||||||
RUN=""
|
RUN=""
|
||||||
MAKEPKG_ARGS="-Ss"
|
MAKEPKG_ARGS="-Ss"
|
||||||
WORKDIR=$PWD
|
WORKDIR=$PWD
|
||||||
|
clean_first=""
|
||||||
|
|
||||||
chrootdir="$CHROOT_SHELL"
|
chrootdir="$CHROOT_SHELL"
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ APPNAME=$(basename "${0}")
|
||||||
|
|
||||||
usage ()
|
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 " Run this script in a PKGBUILD dir to build a package inside a"
|
||||||
echo " clean chroot. All unrecognized arguments passed to this script"
|
echo " clean chroot. All unrecognized arguments passed to this script"
|
||||||
echo " will be passed to makepkg."
|
echo " will be passed to makepkg."
|
||||||
|
@ -29,6 +30,9 @@ usage ()
|
||||||
echo " directories: \$CHROOT_SHELL/{root, rw, union} but only 'root' is"
|
echo " directories: \$CHROOT_SHELL/{root, rw, union} but only 'root' is"
|
||||||
echo " required by default. The rest will be created as needed"
|
echo " required by default. The rest will be created as needed"
|
||||||
echo ""
|
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 "The chroot shell 'root' directory must be created via the following"
|
||||||
echo "command:"
|
echo "command:"
|
||||||
echo " mkarchroot \$CHROOT_SHELL/root base base-devel sudo"
|
echo " mkarchroot \$CHROOT_SHELL/root base base-devel sudo"
|
||||||
|
@ -42,7 +46,8 @@ usage ()
|
||||||
|
|
||||||
while getopts ':c:h' arg; do
|
while getopts ':c:h' arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
c) chrootdir="$OPTARG" ;;
|
r) chrootdir="$OPTARG" ;;
|
||||||
|
c) clean_first=1 ;;
|
||||||
h|?) usage ;;
|
h|?) usage ;;
|
||||||
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
||||||
esac
|
esac
|
||||||
|
@ -73,6 +78,7 @@ if [ ! -d "$chrootdir/root" ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -d "$chrootdir/rw" -a "$clean_first" -eq "1" ] && rm -rf "$chrootdir/rw/"
|
||||||
[ -d "$chrootdir/rw" ] || mkdir "$chrootdir/rw"
|
[ -d "$chrootdir/rw" ] || mkdir "$chrootdir/rw"
|
||||||
[ -d "$chrootdir/union" ] || mkdir "$chrootdir/union"
|
[ -d "$chrootdir/union" ] || mkdir "$chrootdir/union"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue