pkgmeek: fixed the invocation of pkgadd by non-root user

This commit is contained in:
John McQuah 2022-06-01 20:05:15 -04:00
parent fc0ec86cec
commit 8401b2aa25

View File

@ -198,14 +198,13 @@ find . -maxdepth 1 -mindepth 1 -type l -delete
# Install if requested # Install if requested
# First find out how the effective user will invoke pkgadd # First find out how the effective user will invoke pkgadd
[ $UID = 0 ] || PKGMK_SU="sudo "; [ $UID = 0 ] || PKGMK_SU="sudo";
[ -z "$PKGMK_SU" ] || [ -x $(command -v "$PKGMK_SU") ] || PKGMK_SU="/usr/bin/doas "; [ -z "$PKGMK_SU" ] || [ -x "$(command -v $PKGMK_SU)" ] || PKGMK_SU="/usr/bin/doas";
[ -x $(command -v "$PKGMK_SU") ] || PKGMK_SU="su -c"; [ -x "$(command -v $PKGMK_SU)" ] || PKGMK_SU="su -c";
[ -z "$PKGMK_INSTALL_COMMAND" ] || \ [ -z "$PKGMK_INSTALL_COMMAND" ] || { $PKGMK_SU $PKGMK_INSTALL_COMMAND "$pkg_dir$package" \
$PKGMK_SU $PKGMK_INSTALL_COMMAND "$package" || \ && info "$(basename $PKGMK_INSTALL_COMMAND) $package succeeded."; } || \
{ error "Unable to install $package using pkgadd."; { error "Unable to install $package using pkgadd."; exit "$E_INSTALL"; }
exit "$E_INSTALL"; }
# Clean up, part 2 # Clean up, part 2
[ "$PKGMK_KEEP_WORK" = "yes" ] || [ "$pkg_dir" = "$(pwd)/" ] || rm -f "$package" [ "$PKGMK_KEEP_WORK" = "yes" ] || [ "$pkg_dir" = "$(pwd)/" ] || rm -f "$package"