Draft: main: add gui for release upgrades (gnome-software)
the upgrading process works like this:
- gnome software checks if an upgrade is available by calling the
GetUpgradeDetails
dbus method - if an upgrade is available, gnome software sends a notification and show a banner in the updates page
- in the future, we could design a postmarketos themed banner, the gnome software default is used right now
- (the user clicks on the download button)
- gnome software calls the
DownloadUpgradeAsync
dbus method- checks if the user is authorized to upgrade
- replaces mirrordir_alpine and branch_pmaports with the new version in /etc/apk/repositories and saves it to /etc/pmos_upgrader/repositories_new
- downloads the upgrade script (explained later)
- runs apk fetch
- when this dbus method finishes, gnome software calls
InstallOnReboot
- makes a backup of /etc/inittab
- replaces the
default
runlevel with theupgrade
runlevel in the inittab
- gnome software asks the user to reboot
- after reboot, openrc will boot into the upgrade runlevel
- (pmos_upgrader_dbus detects that we are in the upgrade runlevel)
- shows pbsplash with "Upgrading postmarketOS" message
- runs the upgrade script
- runs
apk upgrade -a
with the apk files downloaded before - makes a backup of /etc/apk/repositories
- copies /etc/pmos_upgrader/repositories_new to /etc/apk/repositories
- optionally applies fixes to the system
- runs
- runs the "cleanup script" (/etc/pmos_upgrader/dbus_api/cleanup.py)
- deletes temporary files
- resets the inittab to boot into the default runlevel next time
- reboots
- the upgrade is finished
this can be backported to v23.12 (but not any older release)
pmos_upgrader.cfg
CHANNELS_CFG_URL: the url for the channels.cfg file (pmaports/channels.cfg)
UPGRADE_SCRIPT_URL: the url for the upgrade script (pmaports/upgrade.sh)
ALLOW_UPGRADES_TO_EDGE: if set to 1: upgrades to edge will be allowed
REMOVE_TEMPORARY_FILES: if not set to 0: remove the temporary files in /etc/pmos_upgrader
Debugging
the output of the upgrade script is available at /etc/pmos_upgrader/upgrade.log
the stderr of DownloadUpgradeAsync is available at /etc/pmos_upgrader/errors.log
other logs are available by running killall gnome-software & gnome-software --verbose
(and errors are displayed in a gui by gnome-software)
the repos for postmarketos-upgrader-dbus and gnome-software-plugin-pmos can be moved to the postmarketos namespace (after editing the default values of pmos_upgrader.cfg)
related: #1432