diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2017-04-05 21:35:59 +0200 |
---|---|---|
committer | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2017-04-05 22:17:51 +0200 |
commit | 35da846ddeecbdb99cd4f7a5ea13d650b1fdfda3 (patch) | |
tree | e11241b8b2b0d7659982eda07a72f92f6a990194 | |
parent | 2fd5931a8c67289a8a4acd327b3ce99a5d64c8c7 (diff) | |
download | devtools-35da846ddeecbdb99cd4f7a5ea13d650b1fdfda3.tar.gz devtools-35da846ddeecbdb99cd4f7a5ea13d650b1fdfda3.tar.xz |
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.in | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in index e18e68f..1e46c6e 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -32,7 +32,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} @@ -90,7 +90,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 @@ -209,7 +209,7 @@ prepare_chroot() { sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf" for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \ - "MAKEFLAGS='$MAKEFLAGS'" "PACKAGER='$PACKAGER'" + "MAKEFLAGS='${MAKEFLAGS:-}'" "PACKAGER='${PACKAGER:-}'" do grep -q "^$x" "$copydir/etc/makepkg.conf" && continue echo "$x" >>"$copydir/etc/makepkg.conf" @@ -382,7 +382,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 |