mirror of
https://github.com/optim-enterprises-bv/secureblue.git
synced 2025-11-06 05:17:45 +00:00
feat: add image tag warning to advise users not to use specific tags
This commit is contained in:
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
# Modified from https://github.com/ublue-os/bazzite/blob/main/system_files/desktop/shared/usr/libexec/ublue-motd
|
# Modified from https://github.com/ublue-os/bazzite/blob/main/system_files/desktop/shared/usr/libexec/ublue-motd
|
||||||
|
|
||||||
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
|
RPM_OSTREE_STATUS=$(rpm-ostree status --json)
|
||||||
IMAGE_REF=$(jq -r '."image-ref"' < $IMAGE_INFO)
|
IMAGE_REF_NAME=$(echo $RPM_OSTREE_STATUS | jq -r '.deployments[0]."container-image-reference" // empty | split("/")[-1]')
|
||||||
IMAGE_REF_NAME="${IMAGE_REF##*/}"
|
IMAGE_TAG=$(echo $RPM_OSTREE_STATUS | jq -r '.deployments[0]."container-image-reference" // empty | split(":")[-1]')
|
||||||
IMAGE_TAG=$(jq -r '."image-tag"' < $IMAGE_INFO)
|
|
||||||
TIP=""
|
TIP=""
|
||||||
|
|
||||||
IMAGE_DATE=$(rpm-ostree status --booted | sed -n 's/.*Timestamp: \(.*\)/\1/p')
|
IMAGE_DATE=$(rpm-ostree status --booted | sed -n 's/.*Timestamp: \(.*\)/\1/p')
|
||||||
@@ -15,7 +14,6 @@ DIFFERENCE=$((CURRENT_SECONDS - IMAGE_DATE_SECONDS))
|
|||||||
MONTH=$((7 * 24 * 60 * 60))
|
MONTH=$((7 * 24 * 60 * 60))
|
||||||
|
|
||||||
readarray -t imageTypes < <(jq -r '.imageTypes[]' /usr/libexec/deprecated-images.json)
|
readarray -t imageTypes < <(jq -r '.imageTypes[]' /usr/libexec/deprecated-images.json)
|
||||||
|
|
||||||
isDeprecated=false
|
isDeprecated=false
|
||||||
for imageType in "${imageTypes[@]}"; do
|
for imageType in "${imageTypes[@]}"; do
|
||||||
if [[ "$IMAGE_REF_NAME" == *"$imageType"* ]]; then
|
if [[ "$IMAGE_REF_NAME" == *"$imageType"* ]]; then
|
||||||
@@ -24,8 +22,11 @@ for imageType in "${imageTypes[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if $isDeprecated; then
|
if $isDeprecated; then
|
||||||
TIP='~~~ NOTICE: You are on a deprecated image, please rebase. ~~~\n~~~ For more information, visit https://github.com/secureblue/secureblue/blob/live/config/files/usr/libexec/deprecated-images.json.md ~~~'
|
TIP='~~~ NOTICE: You are on a deprecated image, please rebase. ~~~\n~~~ For more information, visit https://github.com/secureblue/secureblue/blob/live/config/files/usr/libexec/deprecated-images.json.md ~~~'
|
||||||
|
elif ["$IMAGE_TAG" != "latest"]; then
|
||||||
|
TIP='~~~ NOTICE: You are on a specific tag, which is unsupported by secureblue. Rebase to the `latest` tag to ensure you continue to receive updates. ~~~'
|
||||||
elif [ "$DIFFERENCE" -ge "$MONTH" ]; then
|
elif [ "$DIFFERENCE" -ge "$MONTH" ]; then
|
||||||
TIP='~~~ NOTICE: Your current image is over 1 week old, run `ujust update`. ~~~'
|
TIP='~~~ NOTICE: Your current image is over 1 week old, run `ujust update`. ~~~'
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Welcome to secureblue!
|
Welcome to secureblue!
|
||||||
Your image is: %IMAGE_REF_NAME%:%IMAGE_TAG%
|
Your image is: %IMAGE_REF_NAME%
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
| `ujust` | List all available commands |
|
| `ujust` | List all available commands |
|
||||||
|
|||||||
Reference in New Issue
Block a user