summaryrefslogtreecommitdiff
path: root/makechrootpkg.in
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-26 23:00:57 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-26 23:00:57 -0400
commitf566ebf8345cf39f1d50eaa6a679b3ca7088f4eb (patch)
tree1a4cafb0ca91d931e36561b7262f52f2f6433554 /makechrootpkg.in
parent6a87c26b84e5cab7f4a8ead8abd62e58b7ec7f6c (diff)
parente77242c5393a5004fce42483c66f8256981f6ef5 (diff)
Merge branch 'devtools'libretools-20130930
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r--makechrootpkg.in18
1 files changed, 15 insertions, 3 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index ce99d95..cbff882 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -25,6 +25,9 @@ passeddir=
declare -a install_pkgs
declare -i ret=0
+bindmounts_ro=()
+bindmounts_rw=()
+
copy=$USER
[[ -n $SUDO_USER ]] && copy=$SUDO_USER
[[ -z "$copy" || $copy = root ]] && copy=copy
@@ -49,6 +52,8 @@ usage() {
echo 'Flags:'
echo '-h This help'
echo '-c Clean the chroot before building'
+ echo '-d <dir> Bind directory into build chroot as read-write'
+ echo '-D <dir> Bind directory into build chroot as read-only'
echo '-u Update the working copy of the chroot before building'
echo ' This is useful for rebuilds without dirtying the pristine'
echo ' chroot'
@@ -62,10 +67,12 @@ usage() {
exit 1
}
-while getopts 'hcur:I:l:nT' arg; do
+while getopts 'hcur:I:l:nTD:d:' arg; do
case "$arg" in
h) usage ;;
c) clean_first=true ;;
+ D) bindmounts_ro+=(--bind-ro="$OPTARG") ;;
+ d) bindmounts_rw+=(--bind="$OPTARG") ;;
u) update_first=true ;;
r) passeddir="$OPTARG" ;;
I) install_pkgs+=("$OPTARG") ;;
@@ -173,7 +180,9 @@ install_packages() {
pkgname="${install_pkg##*/}"
cp "$install_pkg" "$copydir/$pkgname"
- arch-nspawn "$copydir" pacman -U /$pkgname --noconfirm
+ arch-nspawn "$copydir" \
+ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
+ pacman -U /$pkgname --noconfirm
(( ret += !! $? ))
rm "$copydir/$pkgname"
@@ -337,7 +346,9 @@ load_vars "$USER_HOME/.makepkg.conf"
create_chroot
-$update_first && arch-nspawn "$copydir" pacman -Syu --noconfirm
+$update_first && arch-nspawn "$copydir" \
+ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
+ pacman -Syu --noconfirm
[[ -n ${install_pkgs[*]} ]] && install_packages
@@ -348,6 +359,7 @@ download_sources
if arch-nspawn "$copydir" \
--bind-ro="$PWD:/startdir_host" \
--bind-ro="$SRCDEST:/srcdest_host" \
+ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
/chrootbuild "${makepkg_args[@]}"
then
move_products