revamp compat
This commit is contained in:
31
arch-user/bin/wssh
Executable file
31
arch-user/bin/wssh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $0 <hostname> [ssh-options]"
|
||||
exit 1
|
||||
fi
|
||||
[ -z "$WSCOMPAT_MASTER" ] && WSCOMPAT_MASTER="$(whoami)"
|
||||
read -r -d '' init_cmd << EOF_9oqn7IVF
|
||||
export WS_IS_COMPAT=1
|
||||
export WSCOMPAT_MASTER="$WSCOMPAT_MASTER"
|
||||
export WSCOMPAT_DIR="/tmp/wscompat_${WSCOMPAT_MASTER}_\$(whoami)"
|
||||
|
||||
ws_cleanup() { rm -rf "\$WSCOMPAT_DIR"; }
|
||||
trap ws_cleanup EXIT
|
||||
rm -rf "\$WSCOMPAT_DIR" && mkdir -p "\$WSCOMPAT_DIR" && chmod 700 "\$WSCOMPAT_DIR"
|
||||
|
||||
cat << 'EOF_84EbM3la' > "\$WSCOMPAT_DIR/profile"
|
||||
$(
|
||||
cat "$WSCOMPAT_DIR/profile"
|
||||
for file in "$WSCOMPAT_DIR.profile"*.sh; do
|
||||
if [ -f "$file" ]; then cat "$file"; fi
|
||||
done
|
||||
)
|
||||
EOF_84EbM3la
|
||||
. \$WSCOMPAT_DIR/profile
|
||||
|
||||
# pam, systemd - wrap in login shell
|
||||
exec /bin/bash --login --norc --noprofile -c "exec /bin/bash"
|
||||
EOF_9oqn7IVF
|
||||
|
||||
ssh -t "$@" "$init_cmd"
|
||||
Reference in New Issue
Block a user