uncommited

This commit is contained in:
2025-09-29 12:23:34 +00:00
parent c9dbae4c0c
commit a833ef01eb
5 changed files with 69 additions and 22 deletions

View File

@@ -1,33 +0,0 @@
#!/bin/bash
if [ -z "$WSCOMPAT_DIR" ] || [ "$WS_IS_COMPAT" != 1 ]; then
exit 0
fi
[ -f /etc/profile ] && . /etc/profile
[ -f ~/.profile ] && . ~/.profile
export EDITOR=vim
export SHELL=/bin/bash
export PATH="$WSCOMPAT_DIR:$PATH"
stty intr ^K
export VIMINIT="source $WSCOMPAT_DIR/.vimrc"
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/.vimrc"
{{ template "vimrc" . }}
EOF_04tcIQE7
export INPUTRC="$WSCOMPAT_DIR/.inputrc"
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/.inputrc"
{{ template "inputrc" . }}
EOF_04tcIQE7
export LESSKEYIN="$WSCOMPAT_DIR/.lesskey"
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/.lesskey"
{{ template "lesskey" . }}
EOF_04tcIQE7
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/wssh"
{{ tmpl.Exec "wssh" . | strings.ReplaceAll "EOF_" "EOF_1_" }}
EOF_04tcIQE7

View File

@@ -5,7 +5,7 @@ if [ $# -lt 1 ]; then
exit 1
fi
[ -z "$WSCOMPAT_MASTER" ] && WSCOMPAT_MASTER="$(whoami)"
read -r -d '' init_cmd << EOF_9oqn7IVF
read -r -d '' init_cmd << WSCOMPAT_EOF_9oqn7IVF
export WS_IS_COMPAT=1
export WSCOMPAT_MASTER="$WSCOMPAT_MASTER"
export WSCOMPAT_DIR="/tmp/wscompat_${WSCOMPAT_MASTER}_\$(whoami)"
@@ -14,18 +14,20 @@ read -r -d '' init_cmd << EOF_9oqn7IVF
trap ws_cleanup EXIT
rm -rf "\$WSCOMPAT_DIR" && mkdir -p "\$WSCOMPAT_DIR" && chmod 700 "\$WSCOMPAT_DIR"
cat << 'EOF_84EbM3la' > "\$WSCOMPAT_DIR/profile"
cat << 'WSCOMPAT_EOF_84EbM3la' > "\$WSCOMPAT_DIR/profile"
$(
cat "$WSCOMPAT_DIR/profile"
sed 's/WSCOMPAT_EOF_/WSCOMPAT_EOF__/g' "$WSCOMPAT_DIR/profile"
for file in "$WSCOMPAT_DIR.profile"*.sh; do
if [ -f "$file" ]; then cat "$file"; fi
if [ -f "$file" ]; then
sed 's/WSCOMPAT_EOF_/WSCOMPAT_EOF__/g' "$file"
fi
done
)
EOF_84EbM3la
WSCOMPAT_EOF_84EbM3la
. \$WSCOMPAT_DIR/profile
# pam, systemd - wrap in login shell
exec /bin/bash --login --norc --noprofile -c "exec /bin/bash"
EOF_9oqn7IVF
WSCOMPAT_EOF_9oqn7IVF
ssh -t "$@" "$init_cmd"
/bin/ssh -t "$@" "$init_cmd"