From 05227899e241de83c6d842b7d8713f062ff78465 Mon Sep 17 00:00:00 2001 From: Tulip Blossom Date: Sun, 29 Dec 2024 21:00:00 -0300 Subject: [PATCH] feat(ublue, motd): add shell hooks for motd directly here --- ublue/motd/src/vendor.fish | 16 ++++++++++++++++ ublue/motd/src/vendor.sh | 15 +++++++++++++++ ublue/motd/ublue-motd.spec | 4 ++++ 3 files changed, 35 insertions(+) create mode 100644 ublue/motd/src/vendor.fish create mode 100644 ublue/motd/src/vendor.sh diff --git a/ublue/motd/src/vendor.fish b/ublue/motd/src/vendor.fish new file mode 100644 index 0000000..bdc2ba2 --- /dev/null +++ b/ublue/motd/src/vendor.fish @@ -0,0 +1,16 @@ +#!/usr/bin/fish +#shellcheck disable=all + +function fish_greeting + if test -d "$HOME" + if test ! -e "$HOME"/.config/no-show-user-motd + if test -x "/usr/libexec/ublue-motd" + /usr/libexec/ublue-motd + end + end + end + + if set -q fish_private_mode + echo "fish is running in private mode, history will not be persisted." + end +end diff --git a/ublue/motd/src/vendor.sh b/ublue/motd/src/vendor.sh new file mode 100644 index 0000000..8d6aa5e --- /dev/null +++ b/ublue/motd/src/vendor.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Prevent doublesourcing +if [ -z "$USERMOTDSOURCED" ]; then + USERMOTDSOURCED="Y" + if test -d "$HOME"; then + if test ! -e "$HOME"/.config/no-show-user-motd; then + if test -x "/usr/libexec/ublue-motd"; then + /usr/libexec/ublue-motd + elif test -s "/etc/user-motd"; then + cat /etc/user-motd + fi + fi + fi +fi diff --git a/ublue/motd/ublue-motd.spec b/ublue/motd/ublue-motd.spec index cb69038..9eaf26e 100644 --- a/ublue/motd/ublue-motd.spec +++ b/ublue/motd/ublue-motd.spec @@ -22,10 +22,14 @@ MOTD script for Universal Blue install -Dm0755 ./src/ublue-motd %{buildroot}%{_libexecdir}/ublue-motd install -dm 0755 %{buildroot}%{_datadir}/ublue-os/motd/themes cp -rp ./src/themes/* %{buildroot}%{_datadir}/ublue-os/motd/themes +install -Dm0755 ./src/vendor.sh %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh +install -Dm0755 ./src/vendor.fish %{buildroot}%{_datadir}/fish/vendor_conf.d/%{name}.fish %files %{_libexecdir}/ublue-motd %{_datadir}/ublue-os/motd/themes/* +%{_sysconfdir}/profile.d/%{name}.sh +%{_datadir}/fish/vendor_conf.d/%{name}.fish %changelog %autochangelog