pkgmeek: fixed the invocation of pkgadd by non-root user
This commit is contained in:
parent
fc0ec86cec
commit
8401b2aa25
@ -198,14 +198,13 @@ find . -maxdepth 1 -mindepth 1 -type l -delete
|
||||
|
||||
# Install if requested
|
||||
# First find out how the effective user will invoke pkgadd
|
||||
[ $UID = 0 ] || PKGMK_SU="sudo ";
|
||||
[ -z "$PKGMK_SU" ] || [ -x $(command -v "$PKGMK_SU") ] || PKGMK_SU="/usr/bin/doas ";
|
||||
[ -x $(command -v "$PKGMK_SU") ] || PKGMK_SU="su -c";
|
||||
[ $UID = 0 ] || PKGMK_SU="sudo";
|
||||
[ -z "$PKGMK_SU" ] || [ -x "$(command -v $PKGMK_SU)" ] || PKGMK_SU="/usr/bin/doas";
|
||||
[ -x "$(command -v $PKGMK_SU)" ] || PKGMK_SU="su -c";
|
||||
|
||||
[ -z "$PKGMK_INSTALL_COMMAND" ] || \
|
||||
$PKGMK_SU $PKGMK_INSTALL_COMMAND "$package" || \
|
||||
{ error "Unable to install $package using pkgadd.";
|
||||
exit "$E_INSTALL"; }
|
||||
[ -z "$PKGMK_INSTALL_COMMAND" ] || { $PKGMK_SU $PKGMK_INSTALL_COMMAND "$pkg_dir$package" \
|
||||
&& info "$(basename $PKGMK_INSTALL_COMMAND) $package succeeded."; } || \
|
||||
{ error "Unable to install $package using pkgadd."; exit "$E_INSTALL"; }
|
||||
|
||||
# Clean up, part 2
|
||||
[ "$PKGMK_KEEP_WORK" = "yes" ] || [ "$pkg_dir" = "$(pwd)/" ] || rm -f "$package"
|
||||
|
Loading…
Reference in New Issue
Block a user