Skip to content

Commit

Permalink
feat: Add dynamic MOTD tips and image info (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo authored Jan 28, 2024
1 parent d97f710 commit f855259
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
2 changes: 0 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ RUN if [ ${FEDORA_MAJOR_VERSION} -ge "39" ]; then \

COPY usr /usr
COPY just /tmp/just
COPY motd /tmp/motd
COPY etc/yum.repos.d/ /etc/yum.repos.d/
COPY packages.json /tmp/packages.json
COPY build.sh /tmp/build.sh
Expand Down Expand Up @@ -74,7 +73,6 @@ RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"$
pip install --prefix=/usr yafti && \
pip install --prefix=/usr topgrade && \
rpm-ostree install ublue-update && \
glow -s /tmp/motd/dracula.json /tmp/motd/bluefin.md > /usr/share/ublue-os/user-motd && \
mkdir -p /usr/etc/flatpak/remotes.d && \
wget -q https://dl.flathub.org/repo/flathub.flatpakrepo -P /usr/etc/flatpak/remotes.d && \
cp /tmp/ublue-update.toml /usr/etc/ublue-update/ublue-update.toml && \
Expand Down
8 changes: 8 additions & 0 deletions usr/etc/profile.d/user-motd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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
fi
fi
fi
fi
9 changes: 9 additions & 0 deletions usr/libexec/ublue-motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/bash
TIP_FILE=$(ls "/usr/share/ublue-os/motd/tips/"* | 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_TAG=$(jq -r '."image-tag"' < $IMAGE_INFO)
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"
fi
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Welcome to Bluefin
*Your image: `%IMAGE_NAME%:%IMAGE_TAG%`*

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

*tip: the Project Bluefin team will use this banner to share important information and occasional tips.*
*Tip: %TIP%*

- [Documentation](http://docs.projectbluefin.io/)
- [Discuss](https://community.projectbluefin.io/)
File renamed without changes.
1 change: 1 addition & 0 deletions usr/share/ublue-os/motd/tips/10-tips
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Project Bluefin team will use this banner to share important information and occasional tips.

0 comments on commit f855259

Please sign in to comment.