This commit is contained in:
Yuri Zamyatin 2025-09-29 20:39:27 +00:00
parent a833ef01eb
commit b5a41d9ae0
No known key found for this signature in database
GPG Key ID: 4009A4CD0333B579
2 changed files with 22 additions and 11 deletions

View File

@ -1,11 +1,17 @@
#!/bin/bash
set -e
if [ ! -t 0 ]; then
exec /bin/ssh "$@"
fi
if [ $# -lt 1 ]; then
echo "Usage: $0 <hostname> [ssh-options]"
exit 1
fi
[ -z "$WSCOMPAT_MASTER" ] && WSCOMPAT_MASTER="$(whoami)"
read -r -d '' init_cmd << WSCOMPAT_EOF_9oqn7IVF
read -r -d '' init_cmd << WSCOMPAT_EOF_9oqn7IVF || true
export WS_IS_COMPAT=1
export WSCOMPAT_MASTER="$WSCOMPAT_MASTER"
export WSCOMPAT_DIR="/tmp/wscompat_${WSCOMPAT_MASTER}_\$(whoami)"
@ -27,7 +33,7 @@ WSCOMPAT_EOF_84EbM3la
. \$WSCOMPAT_DIR/profile
# pam, systemd - wrap in login shell
exec /bin/bash --login --norc --noprofile -c "exec /bin/bash"
exec /bin/bash --login --norc --noprofile -c "exec /bin/bash --rcfile \"\$WSCOMPAT_DIR/bashrc\""
WSCOMPAT_EOF_9oqn7IVF
/bin/ssh -t "$@" "$init_cmd"
exec /bin/ssh -t "$@" "$init_cmd"

View File

@ -11,20 +11,26 @@ export EDITOR=vim
export SHELL=/bin/bash
export PATH="$WSCOMPAT_DIR:$PATH"
stty intr ^K
cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/bashrc"
export VIMINIT="source $WSCOMPAT_DIR/.vimrc"
cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/.vimrc"
[ -f ~/.bashrc ] && . ~/.bashrc
stty intr ^K
alias ssh='wssh'
WSCOMPAT_EOF_04tcIQE7
export VIMINIT="source $WSCOMPAT_DIR/vimrc"
cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/vimrc"
{{ template "vimrc" . }}
WSCOMPAT_EOF_04tcIQE7
export INPUTRC="$WSCOMPAT_DIR/.inputrc"
cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/.inputrc"
export INPUTRC="$WSCOMPAT_DIR/inputrc"
cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/inputrc"
{{ template "inputrc" . }}
WSCOMPAT_EOF_04tcIQE7
export LESSKEYIN="$WSCOMPAT_DIR/.lesskey"
cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/.lesskey"
export LESSKEYIN="$WSCOMPAT_DIR/lesskey"
cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/lesskey"
{{ template "lesskey" . }}
WSCOMPAT_EOF_04tcIQE7
@ -32,4 +38,3 @@ cat << 'WSCOMPAT_EOF_04tcIQE7' > "$WSCOMPAT_DIR/wssh"
{{ template "wssh" . }}
WSCOMPAT_EOF_04tcIQE7
chmod +x "$WSCOMPAT_DIR/wssh"
#ln -s "$WSCOMPAT_DIR/wssh" "$WSCOMPAT_DIR/ssh"