diff options
author | merakor <cem@ckyln.com> | 2020-06-20 14:29:40 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-06-20 14:29:40 +0000 |
commit | 6c043469284ce2ffed111c2e90b3b2f25262cd14 (patch) | |
tree | 7c3110bbd5c7ac6fb64ccb031e20c8b734c63955 | |
parent | 0b825ed89ef224bbbbf3870ca814b41b0ff3174a (diff) | |
download | cpt-6c043469284ce2ffed111c2e90b3b2f25262cd14.tar.gz |
kiss: explicitly set USER variable when using 'su'
This had caused packages to be installed using the wrong priviliges
since the root requirement for package installation had been removed.
FossilOrigin-Name: ac797c1ecc29542930363d025aef4ddb397245f60036d47706263060efdc92aa
-rwxr-xr-x | kiss | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -71,10 +71,11 @@ as_root() { # 'doas' or 'su'. Hurrah for choice. [ "$uid" = 0 ] || log "Using '${su:-su}' (to become ${user:=root})" - case $su in - *sudo) sudo -E -u "$user" -- "$@" ;; - *doas) doas -u "$user" -- "$@" ;; - *) su -pc "$* <&3" "$user" 3<&0 </dev/tty ;; + case ${su##*/} in + sudo) sudo -E -u "$user" -- "$@" ;; + doas) doas -u "$user" -- "$@" ;; + su) su -pc "env USER=$user $* <&3" "$user" 3<&0 </dev/tty ;; + *) die "Invalid KISS_SU value: $su" ;; esac } |