diff --git a/config/files/usr/libexec/ublue-motd b/config/files/usr/libexec/ublue-motd index 1a37a1e..018b4d5 100644 --- a/config/files/usr/libexec/ublue-motd +++ b/config/files/usr/libexec/ublue-motd @@ -1,27 +1,25 @@ #!/usr/bin/bash # Modified from https://github.com/ublue-os/bazzite/blob/main/system_files/desktop/shared/usr/libexec/ublue-motd -escape() { - sed 's/[&/\]/\\&/g' <<< "$1" -} IMAGE_INFO="/usr/share/ublue-os/image-info.json" -IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO) -IMAGE_NAME_ESCAPED=$(escape "$IMAGE_NAME") +IMAGE_REF=$(jq -r '."image-ref"' < $IMAGE_INFO) +IMAGE_REF_NAME="${IMAGE_REF##*/}" IMAGE_TAG=$(jq -r '."image-tag"' < $IMAGE_INFO) -IMAGE_TAG_ESCAPED=$(escape "$IMAGE_TAG") TIP="" 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)) +MONTH=$((7 * 24 * 60 * 60)) if [ "$DIFFERENCE" -ge "$MONTH" ]; then - TIP='# 󰇻 Your current image is over 1 month old, run `ujust update`' + TIP='~~~ NOTICE: Your current image is over 1 week old, run `ujust update`. ~~~' +else + TIP='~~~ NOTICE: There is currently no notice. ~~~' fi -TIP_ESCAPED=$(escape "$TIP") - -TIP_OUTPUT=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/secureblue.txt | tr '~' '\n' -echo $TIP_OUTPUT \ No newline at end of file +TIP_OUTPUT=$(sed -e "s/%IMAGE_REF_NAME%/$IMAGE_REF_NAME/g" -e "s/%IMAGE_TAG%/$IMAGE_TAG/g" -e "s/%TIP%/$TIP/g" /usr/share/ublue-os/motd/secureblue.txt) +while IFS= read -r line; do + echo "$line" +done <<< $TIP_OUTPUT diff --git a/config/files/usr/share/ublue-os/motd/secureblue.txt b/config/files/usr/share/ublue-os/motd/secureblue.txt index f02b7cb..f4f1e02 100644 --- a/config/files/usr/share/ublue-os/motd/secureblue.txt +++ b/config/files/usr/share/ublue-os/motd/secureblue.txt @@ -1,11 +1,13 @@ Welcome to secureblue! -Your image is: %IMAGE_NAME%:%IMAGE_TAG% +Your image is: %IMAGE_REF_NAME%:%IMAGE_TAG% Commands: | `ujust` | List all available commands | | `ujust toggle-user-motd` | Toggle this banner on/off | %TIP% + To report an issue: https://github.com/secureblue/secureblue/issues FAQ: https://github.com/secureblue/secureblue/blob/live/FAQ.md -Discord: https://discord.gg/qMTv5cKfbF \ No newline at end of file +Discord: https://discord.gg/qMTv5cKfbF +