-
Notifications
You must be signed in to change notification settings - Fork 9
feat(just): use bootc upgrade when possible #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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." | ||
| 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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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