From e02d70ee1d533f308d1c19eb21ddb1682c49dec6 Mon Sep 17 00:00:00 2001 From: Sparkrai Date: Fri, 14 Jun 2024 12:40:31 -0400 Subject: [PATCH] Fixed some Bluefin stomping Added Bazzite DX motd --- files/files/shared/usr/libexec/ublue-motd | 28 +++++++++++++++++++ .../usr/share/ublue-os/motd/bazzite-dx.md | 16 +++++++++++ files/just/bluefin-system.just | 20 ++++++------- recipes/bazzite-gnome-dx.yml | 7 ++--- 4 files changed, 57 insertions(+), 14 deletions(-) create mode 100644 files/files/shared/usr/libexec/ublue-motd create mode 100644 files/files/shared/usr/share/ublue-os/motd/bazzite-dx.md diff --git a/files/files/shared/usr/libexec/ublue-motd b/files/files/shared/usr/libexec/ublue-motd new file mode 100644 index 0000000..5b065b4 --- /dev/null +++ b/files/files/shared/usr/libexec/ublue-motd @@ -0,0 +1,28 @@ +#!/usr/bin/bash +escape() { + sed 's/[&/\]/\\&/g' <<< "$1" +} + +TIP_FILE=$(find /usr/share/ublue-os/motd/tips/*.md | shuf -n 1) +if [[ -f "$TIP_FILE" ]]; then + IMAGE_INFO="/usr/share/ublue-os/image-info.json" + IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO) + IMAGE_NAME_ESCAPED=$(escape "$IMAGE_NAME") + IMAGE_TAG=$(jq -r '."image-tag"' < $IMAGE_INFO) + IMAGE_TAG_ESCAPED=$(escape "$IMAGE_TAG") + TIP="󰋼 $(shuf -n 1 "$TIP_FILE")" + + IMAGE_DATE=$(rpm-ostree status --booted | sed -n 's/.*Timestamp: \(.*\)/\1/p') + IMAGE_DATE_SECONDS=$(date -d "$IMAGE_DATE" +%s) + CURRENT_SECONDS=$(date +%s) + DIFFERENCE=$((CURRENT_SECONDS - IMAGE_DATE_SECONDS)) + MONTH=$((30 * 24 * 60 * 60)) + if [ "$DIFFERENCE" -ge "$MONTH" ]; then + #shellcheck disable=2016 + TIP='# 󰇻 Your current image is over 1 month old, run `ujust update`' + fi + + TIP_ESCAPED=$(escape "$TIP") + + sed -e "s/%IMAGE_NAME%/$IMAGE_NAME_ESCAPED/g" -e "s/%IMAGE_TAG%/$IMAGE_TAG_ESCAPED/g" -e "s/%TIP%/$TIP_ESCAPED/g" /usr/share/ublue-os/motd/bazzite-dx.md | tr '~' '\n' | /usr/bin/glow -s auto - +fi diff --git a/files/files/shared/usr/share/ublue-os/motd/bazzite-dx.md b/files/files/shared/usr/share/ublue-os/motd/bazzite-dx.md new file mode 100644 index 0000000..1b876ab --- /dev/null +++ b/files/files/shared/usr/share/ublue-os/motd/bazzite-dx.md @@ -0,0 +1,16 @@ +# 󱍢 Welcome to Bazzite DX +󱋩 `%IMAGE_NAME%:%IMAGE_TAG%` + +|  Command | Description | +| ------- | ----------- | +| `ujust --choose` | Show available commands | +| `ujust toggle-user-motd` | Toggle banner on/off | +| `ujust bluefin-cli` | Enable terminal bling | +| `brew help` | Manage command line packages | + +%TIP% + +- 󰊤 [Issues](https://github.com/Sparkrai/bazzite-dx/issues) +- 󰊤 [Bazzite Documentation](https://universal-blue.discourse.group/docs?topic=561) +- 󰈙 [Bluefin Documentation](http://docs.projectbluefin.io/) +- 󰊌 [Discuss](https://universal-blue.discourse.group/c/bazzite/5) \ No newline at end of file diff --git a/files/just/bluefin-system.just b/files/just/bluefin-system.just index 7f2444a..bde569b 100644 --- a/files/just/bluefin-system.just +++ b/files/just/bluefin-system.just @@ -37,7 +37,7 @@ devmode: if grep -q "/var/ublue-os/image" <<< $CURRENT_IMAGE then echo "" - echo "Before we can switch to the Bluefin Developer Experience" + echo "Before we can switch to the Bazzite Developer Experience" echo "the current system needs an update. Please run 'just update'" echo "and reboot your system when the update is finished." exit @@ -262,14 +262,14 @@ install-system-flatpaks: configure-grub: @/usr/libexec/configure-grub.sh -# Rebase assistant -rebase-helper: - @/usr/bin/ublue-rollback-helper +# # Rebase assistant +# rebase-helper: +# @/usr/bin/ublue-rollback-helper -alias rollback-helper := rebase-helper +# alias rollback-helper := rebase-helper -update-ng: - echo "Note: This command doesn't work if you have locally layered packages" - sudo bootc upgrade - flatpak update -y - brew upgrade +# update-ng: +# echo "Note: This command doesn't work if you have locally layered packages" +# sudo bootc upgrade +# flatpak update -y +# brew upgrade diff --git a/recipes/bazzite-gnome-dx.yml b/recipes/bazzite-gnome-dx.yml index adfa7da..a602544 100755 --- a/recipes/bazzite-gnome-dx.yml +++ b/recipes/bazzite-gnome-dx.yml @@ -29,7 +29,6 @@ modules: - ../bluefin/system_files/shared/usr/share/ublue-os/bluefin-cli: /usr/share/ublue-os/bluefin-cli - ../bluefin/system_files/shared/usr/share/ublue-os/homebrew: /usr/share/ublue-os/homebrew - ../bluefin/system_files/shared/usr/share/ublue-os/quadlets: /usr/share/ublue-os/quadlets - - ../bluefin/system_files/shared/usr/share/ublue-os/ublue-os.jsonc: /usr/share/ublue-os/ublue-os.jsonc - ../bluefin/system_files/silverblue/usr/etc/flatpak: /usr/etc/flatpak # - ../bluefin/system_files/silverblue/usr/share: /usr/share # Avoid Bluefin branding - ../bluefin/system_files/dx: / @@ -49,9 +48,9 @@ modules: - simple-scan - gnome-shell-extension-appindicator - gnome-shell-extension-blur-my-shell - - gnome-shell-extension-caffeine + # - gnome-shell-extension-caffeine # Already in Bazzite - gnome-shell-extension-dash-to-dock - - gnome-shell-extension-gsconnect + # - gnome-shell-extension-gsconnect # Already in Bazzite - libgda-sqlite - libgda - libratbag-ratbagd @@ -67,7 +66,7 @@ modules: - type: gnome-extensions install: - - Logo Menu + # - Logo Menu # Already in Bazzite - Search Light # Install Starhip and activate RPM Fusion repos