Preserve PATH for setup actions

This commit is contained in:
Manuel Thalmann 2024-11-27 05:24:53 +01:00
parent ba0c1076c3
commit 68ddaaff7c

View file

@ -48,7 +48,7 @@ function runSetupUserAction -V dir
set -l cmdline (cat /proc/$fish_pid/cmdline | string split0) set -l cmdline (cat /proc/$fish_pid/cmdline | string split0)
if [ (id -u) -ne 0 ] if [ (id -u) -ne 0 ]
sudo --set-home --preserve-env $cmdline sudo --set-home --preserve-env env "PATH=$PATH" $cmdline
else else
if [ -z "$TMUX" ] if [ -z "$TMUX" ]
tmux new-session -e "$env" $cmdline tmux new-session -e "$env" $cmdline
@ -70,7 +70,7 @@ function runSetupUserAction -V dir
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL" echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
end >"$sudoConfig" end >"$sudoConfig"
and sudo --preserve-env --set-home --user "$name" $cmdline and sudo --preserve-env --set-home --user "$name" env "PATH=$PATH" $cmdline
disposeAction disposeAction
rm "$sudoConfig" rm "$sudoConfig"
userdel -rf "$name" userdel -rf "$name"