From b5a41d9ae0464c15387b7758e9737cc35ecaf7ab Mon Sep 17 00:00:00 2001 From: Yuri Zamyatin Date: Mon, 29 Sep 2025 20:39:27 +0000 Subject: [PATCH] wscompat --- arch-user/bin/wssh | 12 ++++++++--- .../config/workspace-compat/profile.tmpl | 21 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/arch-user/bin/wssh b/arch-user/bin/wssh index a287322..ceb437e 100755 --- a/arch-user/bin/wssh +++ b/arch-user/bin/wssh @@ -1,11 +1,17 @@ #!/bin/bash +set -e + +if [ ! -t 0 ]; then + exec /bin/ssh "$@" +fi if [ $# -lt 1 ]; then echo "Usage: $0 [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" diff --git a/arch-user/config/workspace-compat/profile.tmpl b/arch-user/config/workspace-compat/profile.tmpl index 335159e..37c2a8e 100644 --- a/arch-user/config/workspace-compat/profile.tmpl +++ b/arch-user/config/workspace-compat/profile.tmpl @@ -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"