-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Escape special characters in motd script
- Loading branch information
Showing
3 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
system_files/desktop/shared/usr/share/ublue-os/motd/tips/10-desktop-tips.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |