Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Replace tips with a check engine light when the booted image is over a month old #863

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion usr/libexec/ublue-motd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ if [[ -f "$TIP_FILE" ]]; then
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")
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
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/bluefin.md | /usr/bin/glow -s auto -
fi
8 changes: 4 additions & 4 deletions usr/share/ublue-os/motd/bluefin.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 󱍢 Welcome to Bluefin (󰂡eta)
: `%IMAGE_NAME%:%IMAGE_TAG%`
󱋩 `%IMAGE_NAME%:%IMAGE_TAG%`

|  Command | Description |
| ------- | ----------- |
| `ujust` | List all available commands |
| `ujust toggle-user-motd` | Toggle this banner on/off |
| `ujust bluefin-cli` | Configure the terminal (Alpha) |

Tip: %TIP%
%TIP%

- 󰊤 [Issues](https://issues.projectbluefin.io)
- 󰈙 [Documentation:](http://docs.projectbluefin.io/)
- 󰊌 [Discuss:](https://community.projectbluefin.io/)
- 󰈙 [Documentation](http://docs.projectbluefin.io/)
- 󰊌 [Discuss](https://community.projectbluefin.io/)
Loading