particle-os-modules/modules/bling/installers/ublue-update.sh
gerblesh d71fa6cb13 fix: install topgrade in ublue-update.sh
`ublue-update` recently moved to `topgrade` for executing updates (https://github.com/ublue-os/ublue-update/pull/102). Because of this move, `ublue-update` needs `topgrade` to be installed in order to install the rpm: https://github.com/ublue-os/ublue-update/blob/main/ublue-update.spec
2024-01-27 10:55:20 -08:00

31 lines
961 B
Bash

#!/usr/bin/env bash
# Tell build process to exit if there are any errors.
set -euo pipefail
get_config_value() {
sed -n '/^'"$1"'=/{s/'"$1"'=//;p}' "$2"
}
set_config_value() {
CURRENT=$(get_config_value "$1" "$3")
sed -i 's/'"$1"'='"$CURRENT"'/'"$1"'='"$2"'/g' "$3"
}
# Check if ublue-os-update-services rpm is installed, these services conflict with ublue-update
if rpm -q ublue-os-update-services > /dev/null; then
rpm-ostree override remove ublue-os-update-services
fi
# Change the conflicting update policy for rpm-ostreed
RPM_OSTREE_CONFIG="/etc/rpm-ostreed.conf"
if [[ -f "$RPM_OSTREE_CONFIG" ]]; then
if [[ $(get_config_value "AutomaticUpdatePolicy" "$RPM_OSTREE_CONFIG") == "stage" ]]; then
set_config_value "AutomaticUpdatePolicy" "none" "$RPM_OSTREE_CONFIG"
fi
fi
systemctl disable rpm-ostreed-automatic.timer
# topgrade is REQUIRED by ublue-update to install
pip install topgrade
rpm-ostree install ublue-update