summaryrefslogtreecommitdiff
path: root/makechrootpkg.in
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-09-13 16:45:39 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2017-09-13 16:45:39 -0400
commit200c5f3d7476e31720fb400fef6f40aff0b5c805 (patch)
tree64880404491793cc1ce5ee97b503e5cdf1cda712 /makechrootpkg.in
parent75c741615ecb8e708f9bd8600cf77383be5cecf3 (diff)
parent2277bec07b9f4aff10d918b3c054adf74a16005f (diff)
downloaddevtools32-libretools-20170913.tar.xz
Merge branch 'lukeshu/rebase/master'libretools-20170913
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r--makechrootpkg.in42
1 files changed, 21 insertions, 21 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 83eb787..5511002 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -16,9 +16,9 @@ m4_include(lib/archroot.sh)
shopt -s nullglob
init_variables() {
- default_makepkg_args=(-s --noconfirm -L --holdver)
+ default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
makepkg_args=("${default_makepkg_args[@]}")
- repack=false
+ keepbuilddir=false
update_first=false
clean_first=false
run_namcap=false
@@ -178,17 +178,17 @@ install_packages() {
return $ret
}
-# Usage: prepare_chroot $copydir $HOME $repack $run_namcap
+# Usage: prepare_chroot $copydir $HOME $keepbuilddir $run_namcap
# Globals:
# - MAKEFLAGS
# - PACKAGER
prepare_chroot() {
local copydir=$1
local USER_HOME=$2
- local repack=$3
+ local keepbuilddir=$3
local run_namcap=$4
- $repack || rm -rf "$copydir/build"
+ $keepbuilddir || rm -rf "$copydir/build"
local builduser_uid builduser_gid
builduser_uid="${SUDO_UID:-$UID}"
@@ -314,14 +314,9 @@ download_sources() {
chmod 1777 "$builddir"
# Ensure sources are downloaded
- if [[ "$(id -u "$makepkg_user")" != 0 ]]; then
- sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
- makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
- die "Could not download sources."
- else
- error "Running makepkg as root is not allowed."
- exit 1
- fi
+ sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
+ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
+ die "Could not download sources."
# Clean up garbage from verifysource
rm -rf "$builddir"
@@ -377,7 +372,7 @@ main() {
r) passeddir="$OPTARG" ;;
I) install_pkgs+=("$OPTARG") ;;
l) copy="$OPTARG" ;;
- n) run_namcap=true; makepkg_args+=(-i) ;;
+ n) run_namcap=true; makepkg_args+=(--install) ;;
T) temp_chroot=true; copy+="-$$" ;;
U) makepkg_user="$OPTARG" ;;
h|*) usage ;;
@@ -404,13 +399,13 @@ main() {
# Pass all arguments after -- right to makepkg
makepkg_args+=("${@:$OPTIND}")
- # See if -R was passed to makepkg
- for arg in "${@:OPTIND}"; do
+ # See if -R or -e was passed to makepkg
+ for arg in "${makepkg_args[@]}"; do
case ${arg%%=*} in
- -*R*|--repackage)
- repack=true
- break 2
- ;;
+ --repackage|--noextract) keepbuilddir=true; break ;;
+ --repackage|--noextract) keepbuilddir=true; break ;;
+ --*) ;;
+ -*R*|-*e*) keepbuilddir=true; break ;;
esac
done
@@ -449,9 +444,14 @@ main() {
[[ -f PKGBUILD ]] || return $ret
fi
+ if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
+ error "Running makepkg as root is not allowed."
+ exit 1
+ fi
+
download_sources "$copydir" "$makepkg_user"
- prepare_chroot "$copydir" "$USER_HOME" "$repack"
+ prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir"
if arch-nspawn "$copydir" \
--bind="$PWD:/startdir" \