From e431d69004167aa11960e6f3006e48038487587d Mon Sep 17 00:00:00 2001 From: Thijs Putman Date: Thu, 26 Oct 2023 15:36:37 +0200 Subject: [PATCH] Fix header for Ubuntu 23.04 (again) Changed to order to fix an issue in VS Code, which broke the logic again for Ubuntu 23.04... No clean way around duplicating the VS Code check. --- .bashrc.d/00-header | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.bashrc.d/00-header b/.bashrc.d/00-header index 7700088..9fcb9a5 100755 --- a/.bashrc.d/00-header +++ b/.bashrc.d/00-header @@ -8,18 +8,20 @@ if [[ $0 != 'ssh '* ]]; then HEADER_SHOWN=motd - # If no MOTD was shown _or_ we're running inside VS Code's integrated - # terminal, we'll show a short/single-line header instead - if + # Assume an SSH-session always sees a full MOTD(-like) header (unless it's + # running inside VS Code). Ubuntu up to 22.04 would set MOTD_SHOWN=pam, but + # since 23.04 there doesn't appear to be a better way to determine whether the + # MOTD was shown.. + if [[ (-n "$SSH_CLIENT" || -n "$SSH_TTY") && + "$TERM_PROGRAM" != "vscode" ]]; then + HEADER_SHOWN=motd-ssh + # Otherwise, if no MOTD was shown (or we're running inside VS Code's + # integrated terminal), we'll show a short/single-line header + elif [ -z "$MOTD_SHOWN" ] || [ "$TERM_PROGRAM" == "vscode" ] then . /etc/update-motd.d/00-header HEADER_SHOWN=short - # Assume an SSH-session always sees a full MOTD(-like) header. Ubuntu up to - # 22.04 would set MOTD_SHOWN=pam, but since 23.04 there doesn't appear to be - # a better way to determine whether the MOTD was shown.. - elif [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then - HEADER_SHOWN=motd-ssh fi # In case of VS Code's intergrated terminal, we don't want to see any further