summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2016-10-22 16:23:57 +0200
committerJonas Smedegaard <dr@jones.dk>2016-10-22 16:45:50 +0200
commit4f6ddfb335eb1b423e45380acc7029b6d1901dd4 (patch)
treeeb4f0e1c2fe326ecdced329e9a211c8c5dd2645c
parent1e2e5d80a02c2806c4a988920b4f1094f9108dec (diff)
Simplify wrap su (was and still is broken in local use, unrelated to this change).
-rwxr-xr-xxsh16
1 files changed, 5 insertions, 11 deletions
diff --git a/xsh b/xsh
index 31608c3..5164c38 100755
--- a/xsh
+++ b/xsh
@@ -46,6 +46,9 @@ done
[ $# -gt 0 ] || set -- /bin/bash
+# FIXME: needs shell wrapper (provided by SSH but not in local use)
+[ -z "$SU" ] || set -- "echo -n 'Changing to root...: '; su -c \"cd; "$@"\""
+
[ -z "$SUDO" ] || set -- sudo -i -- "$@"
# Split program name from its options
@@ -61,21 +64,12 @@ if [ "$V" = 1 ]; then
fi
prg="$prg_base $prg_opts"
-prg_su="echo -n 'Changing to root...: '; su -c \"cd; $prg\""
case "$HOST" in
'')
- if [ -n "$SU" ]; then
- termwrapper $prg_su
- else
- termwrapper $prg
- fi
+ termwrapper $prg
;;
*)
- if [ -n "$SU" ]; then
- termwrapper ssh $ssh_opts $HOST $prg_su
- else
- termwrapper ssh $ssh_opts $HOST $prg
- fi
+ termwrapper ssh $ssh_opts $HOST $prg
;;
esac