Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-02-15 15:25:22 -0500
committerLuke Shumaker <lukeshu@parabola.nu>2017-02-15 15:25:22 -0500
commit90fe539365baf28be143e3ab500bf654ef3b98d5 (patch)
treea13504efd42e441929559a1630087c696b45172d
parent22da1ef5087e7065439e23187f0984148a905fff (diff)
makechrootpkg: Adjust to have the functions work with `set -u`.
Even though main() doesn't call `set -u`; this way the functions will continue to work if copied into an environment with `set -u`, or so that we are ready if we ever want to start using `set -u`.
-rw-r--r--makechrootpkg.in10
1 files changed, 5 insertions, 5 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 3f4e009..afd14f6 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -31,7 +31,7 @@ bindmounts_ro=()
bindmounts_rw=()
copy=$USER
-[[ -n $SUDO_USER ]] && copy=$SUDO_USER
+[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
[[ -z "$copy" || $copy = root ]] && copy=copy
src_owner=${SUDO_USER:-$USER}
@@ -84,7 +84,7 @@ load_vars() {
[[ -f $makepkg_conf ]] || return 1
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
- [[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf")
+ [[ -z ${!var:-} ]] && eval $(grep "^${var}=" "$makepkg_conf")
done
return 0
@@ -290,12 +290,12 @@ prepare_chroot() {
printf 'builduser:x:%d:100:builduser:/build:/bin/bash\n' "$builduser_uid" >>"$copydir/etc/passwd"
chown -R "$builduser_uid" "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
- if [[ -n $MAKEFLAGS ]]; then
+ if [[ -n ${MAKEFLAGS:-} ]]; then
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
echo "MAKEFLAGS='${MAKEFLAGS}'" >> "$copydir/etc/makepkg.conf"
fi
- if [[ -n $PACKAGER ]]; then
+ if [[ -n ${PACKAGER:-} ]]; then
sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf"
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
fi
@@ -530,7 +530,7 @@ $update_first && arch-nspawn "$copydir" \
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
pacman -Syu --noconfirm
-if [[ -n ${install_pkgs[*]} ]]; then
+if [[ -n ${install_pkgs[*]:-} ]]; then
install_packages "$copydir" "${install_pkgs[@]}"
ret=$?
# If there is no PKGBUILD we have done