Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions system_files/shared/usr/share/ublue-os/just/update.just
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ alias upgrade := update

# Update system, flatpaks and homebrew packages all at once
update:
#!/usr/bin/bash
#!/usr/bin/env bash

set -eou pipefail

if systemctl cat -- uupd.timer &> /dev/null; then
SERVICE="uupd.service"
else
Expand All @@ -14,12 +17,40 @@ update:
echo "automatic updates are currently running, use \`journalctl -fexu $SERVICE\` to see logs"
exit 1
fi
if command -v rpm-ostree >/dev/null 2>&1 && [ -f /etc/rpm-ostreed.conf ] && grep -q -E -e "^[[:space:]]*LockLayering[[:space:]]*=[[:space:]]*true([[:space:]]*(#.*)?)?$" /etc/rpm-ostreed.conf ; then
sudo bootc upgrade

if grep -q -E "(^|\s)composefs=.*\S" /proc/cmdline; then
IS_COMPOSEFS="true"
IS_OSTREE="false"
elif grep -q -E "(^|\s)ostree=.*\S" /proc/cmdline; then
IS_COMPOSEFS="false"
IS_OSTREE="true"
else
rpm-ostree upgrade
echo "Not booted, nothing to upgrade."

@renner0e renner0e Aug 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could also handle the case when we are in a container as /proc/cmdline is present there as well

exit 1
fi
# rpm-ostree used due to bootc upgrade not supporting local layered packages

if [[ "${IS_COMPOSEFS}" == "true" ]]; then
sudo bootc upgrade

elif [[ "${IS_OSTREE}" == "true" ]]; then
STATUS=$(sudo bootc status --json | jq ".status")

STAGED_INCOMPAT=$(echo "${STATUS}" | jq ".staged.incompatible")
BOOTED_INCOMPAT=$(echo "${STATUS}" | jq ".booted.incompatible")

if [[ "${STAGED_INCOMPAT}" == "true" || ( "${BOOTED_INCOMPAT}" == "true" && -z "${STAGED_INCOMPAT}" ) || "${BOOTED_INCOMPAT}" == "true" ]]; then
INCOMPAT="true"
else
INCOMPAT="false"
fi

if [[ "${INCOMPAT}" == "true" ]]; then
rpm-ostree upgrade
else
sudo bootc upgrade
fi
fi
Comment on lines +38 to +52

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this mostly works from my testing

This should also support the usecase of

layered packages/not compatible with bootc -> has a staged image with rpm-ostree reset (is compatible) -> ujust upgrade uses bootc path

and the inverse of that

booted deployment is compatible, staged one is not compatible -> use rpm-ostree

I have not tested rpm-ostree rollback/bootc rollback behavior at all


# Updates system Flatpaks
if flatpak remotes | grep -q system; then
flatpak update -y
Expand Down