revamp compat

This commit is contained in:
2025-09-28 22:08:05 +00:00
parent 6bf779a68e
commit 3398c6b4ef
12 changed files with 83 additions and 311 deletions

31
arch-user/bin/wssh Executable file
View 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"