added OLD_HOME variable pointing to HOME before sudo
authorChris Koeritz <fred@gruntose.com>
Wed, 29 Sep 2021 20:08:28 +0000 (16:08 -0400)
committerChris Koeritz <fred@gruntose.com>
Wed, 29 Sep 2021 20:08:28 +0000 (16:08 -0400)
makes it a bit easier to get back to the "real" user's home dir who started the sudo.

scripts/core/functions.sh

index 8c9c0b2aceaa64699457f5ba2ace684dbddb6fe9..8ad72ccf0aae36683981105e1c14383bf042c0a3 100644 (file)
@@ -466,9 +466,9 @@ if [ -z "$skip_all" ]; then
 
     # launch sudo with just the variables we want to reach the other side.
     local varmods=
-#    varmods+="PATH= "
+    varmods+="OLD_HOME=$HOME "
     if [ ! -z "$IMPORTED_XAUTH" ]; then varmods+="IMPORTED_XAUTH=$IMPORTED_XAUTH "; fi
-    if [ ! -z "$SSH_AUTH_SOCK" ]; then varmods+="SSH_AUTH_SOCK=$SSH_AUTH_SOCK"; fi
+    if [ ! -z "$SSH_AUTH_SOCK" ]; then varmods+="SSH_AUTH_SOCK=$SSH_AUTH_SOCK "; fi
     /usr/bin/sudo $varmods "$@"
     retval=$?