From d381f48755f8a564d017d947a9fa3e0a41833572 Mon Sep 17 00:00:00 2001 From: "Jorge O. Castro" Date: Sun, 19 Apr 2026 12:01:53 -0400 Subject: [PATCH] fix(motd): guard against double display on GNOME OS / freedesktop-sdk base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On freedesktop-sdk based images (like dakota), /etc/bashrc unconditionally sources /etc/profile.d/*.sh — unlike Fedora's /etc/bashrc which guards with 'shopt -q login_shell'. This means a Ghostty login shell fires ublue-motd.sh twice: /etc/profile -> profile.d -> MOTD #1 ~/.profile -> ~/.bashrc -> /etc/bashrc -> profile.d -> MOTD #2 Add UBLUE_MOTD_SHOWN guard, identical to the existing BLING_SOURCED pattern in bling.sh, to make the script idempotent. Fixes: projectbluefin/dakota#200 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Assisted-by: Claude Sonnet 4.6 via GitHub Copilot --- system_files/shared/etc/profile.d/ublue-motd.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system_files/shared/etc/profile.d/ublue-motd.sh b/system_files/shared/etc/profile.d/ublue-motd.sh index 2cdb46aa..cc8f9ff6 100644 --- a/system_files/shared/etc/profile.d/ublue-motd.sh +++ b/system_files/shared/etc/profile.d/ublue-motd.sh @@ -1,3 +1,9 @@ #!/usr/bin/env bash +# Guard against double-sourcing: /etc/profile and /etc/bashrc both source +# profile.d on GNOME OS / freedesktop-sdk based images (unlike Fedora which +# guards /etc/bashrc with shopt -q login_shell). Same pattern as BLING_SOURCED. +[ "${UBLUE_MOTD_SHOWN:-0}" -eq 1 ] && return 0 +export UBLUE_MOTD_SHOWN=1 + [ ! -e "$HOME"/.config/no-show-user-motd ] && ublue-motd