cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 6fdea449f9f4fc5e2fc0132a904f251e00c44115
parent 330f3da5b19b71f7d3e7557a1fef1d5d18429c1c
Author: Cem Keylan <cem@ckyln.com>
Date:   Sat, 20 Jun 2020 17:29:40 +0300

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.

Diffstat:
Mkiss | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kiss b/kiss @@ -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 }