Skip to content

Commit

Permalink
Fix header for Ubuntu 23.04 (again)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thijsputman committed Oct 26, 2023
1 parent 04aa15f commit e431d69
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .bashrc.d/00-header
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e431d69

Please sign in to comment.