Allow makechroot options in archbuild

This will allow, by example, to easily build a package with a custom pkg.

staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz
staging-x86_64-build -- -n

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
This commit is contained in:
Sébastien Luttringer 2013-01-02 01:42:44 +01:00 committed by Pierre Schmitz
parent 828143751b
commit fb71ad1e7f
1 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,7 @@
m4_include(lib/common.sh) m4_include(lib/common.sh)
base_packages=(base base-devel sudo) base_packages=(base base-devel sudo)
makechrootpkg_args=(-c -n)
cmd="${0##*/}" cmd="${0##*/}"
if [[ "${cmd%%-*}" == 'multilib' ]]; then if [[ "${cmd%%-*}" == 'multilib' ]]; then
@ -18,13 +19,17 @@ chroots='/var/lib/archbuild'
clean_first=false clean_first=false
usage() { usage() {
echo "Usage: $cmd" echo "Usage: $cmd [options] -- [makechrootpkg args]"
echo ' -h This help'
echo ' -c Recreate the chroot before building' echo ' -c Recreate the chroot before building'
echo ' -r <dir> Create chroots in this directory' echo ' -r <dir> Create chroots in this directory'
echo ''
echo "Default makechrootpkg args: ${makechrootpkg_args[*]}"
echo ''
exit 1 exit 1
} }
while getopts 'cr:' arg; do while getopts 'hcr:' arg; do
case "${arg}" in case "${arg}" in
c) clean_first=true ;; c) clean_first=true ;;
r) chroots="$OPTARG" ;; r) chroots="$OPTARG" ;;
@ -32,7 +37,10 @@ while getopts 'cr:' arg; do
esac esac
done done
if [[ "$EUID" != '0' ]]; then # Pass all arguments after -- right to makepkg
makechrootpkg_args=("${@:$OPTIND}")
if (( EUID )); then
die 'This script must be run as root.' die 'This script must be run as root.'
fi fi
@ -71,4 +79,4 @@ else
fi fi
msg "Building in chroot for [${repo}] (${arch})..." msg "Building in chroot for [${repo}] (${arch})..."
exec setarch "${arch}" makechrootpkg -c -n -r "${chroots}/${repo}-${arch}" exec setarch "${arch}" makechrootpkg "${makechrootpkg_args[@]}" -r "${chroots}/${repo}-${arch}"