Skip to content

Commit

Permalink
fix: Escape special characters in motd script
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Jan 29, 2024
1 parent ea5090e commit 7ed7e7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion system_files/desktop/shared/usr/libexec/ublue-motd
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/usr/bin/bash
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")
sed -e "s/%IMAGE_NAME%/$IMAGE_NAME/g" -e "s/%IMAGE_TAG%/$IMAGE_TAG/g" -e "s/%TIP%/$TIP/g" /usr/share/ublue-os/motd/bazzite.md | /usr/bin/glow -s auto -
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.md | /usr/bin/glow -s auto -
fi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
| `ujust toggle-user-motd` | Toggle this banner on/off |
| `neofetch` | View system information |

󰋼 *%TIP%*
󰋼 %TIP%
- [ Report an issue](https://github.com/ublue-os/bazzite/issues)
- [󰙯 Discord](https://discord.bazzite.gg/)
- [󰈙 Documentation](http://docs.bazzite.gg/)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
It is **always** better to install packages with Distrobox than to layer them with rpm-ostree. `ujust distrobox` makes it easy!
Packages installed in Distrobox can be exported to appear like any other application ([View documentation](https://github.com/89luca89/distrobox/blob/main/docs/usage/distrobox-export.md)).
Update break something? You can roll back and pin the previous release or rebase by build date ([View our guide](https://universal-blue.discourse.group/docs?topic=513)).
Packages installed in Distrobox can be exported to appear like any other application - [View documentation](https://github.com/89luca89/distrobox/blob/main/docs/usage/distrobox-export.md).
Update break something? You can roll back and pin the previous release or rebase by build date - [View our guide](https://universal-blue.discourse.group/docs?topic=513).
Installing a non-Steam Windows game? Lutris is pre-installed for better handling of wine prefixes.
BTRFS is used by default for external drives, and we recommend that or EXT4 over NTFS ([More info here](https://github.com/ValveSoftware/Proton/wiki/Using-a-NTFS-disk-with-Linux-and-Windows)).
BTRFS is used by default for external drives, and we recommend that or EXT4 over NTFS - [More info here](https://github.com/ValveSoftware/Proton/wiki/Using-a-NTFS-disk-with-Linux-and-Windows).

0 comments on commit 7ed7e7f

Please sign in to comment.