Skip to content

Commit

Permalink
fix: update motd generation (#853)
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Gospodnetich <[email protected]>
  • Loading branch information
castrojo and KyleGospo authored Jan 29, 2024
1 parent 08e3360 commit 844bc15
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 197 deletions.
11 changes: 9 additions & 2 deletions usr/libexec/ublue-motd
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/usr/bin/bash
TIP_FILE=$(ls "/usr/share/ublue-os/motd/tips/"* | shuf -n 1)
escape() {
sed 's/[&/\]/\\&/g' <<< "$1"
}

TIP_FILE=$(ls "/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")
/usr/bin/glow -s /usr/share/ublue-os/motd/design/dracula.json /usr/share/ublue-os/motd/design/bluefin.md | sed -e "s/%IMAGE_NAME%/$IMAGE_NAME/g" -e "s/%IMAGE_TAG%/$IMAGE_TAG/g" -e "s/%TIP%/$TIP/g"
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
| `ujust toggle-user-motd` | Toggle this banner on/off |
| `ujust bluefin-cli` | Configure the terminal (Alpha) |

Report issues at: 󰊤 https://issues.projectbluefin.io

*Tip: %TIP%*
Tip: %TIP%

- 󰊤 [Issues](https://issues.projectbluefin.io)
- 󰈙 [Documentation:](http://docs.projectbluefin.io/)
- 󰊌 [Discuss:](https://community.projectbluefin.io/)
192 changes: 0 additions & 192 deletions usr/share/ublue-os/motd/design/dracula.json

This file was deleted.

File renamed without changes.

0 comments on commit 844bc15

Please sign in to comment.