From d4e8ec50f226aa894f33d0a00d90ef5a77905f75 Mon Sep 17 00:00:00 2001 From: Jakub Kujawa Date: Sat, 27 Jan 2024 20:47:40 +0100 Subject: [PATCH] fix: fix problem with installing `topgrade' package --- config/common_modules/bling.yml | 1 - config/common_modules/scripts.yml | 1 + config/scripts/ublue-update.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 config/scripts/ublue-update.sh diff --git a/config/common_modules/bling.yml b/config/common_modules/bling.yml index 546a0a1f18..bc1a132d67 100644 --- a/config/common_modules/bling.yml +++ b/config/common_modules/bling.yml @@ -1,5 +1,4 @@ type: bling install: - 1password - - ublue-update - dconf-update-service diff --git a/config/common_modules/scripts.yml b/config/common_modules/scripts.yml index 0a4cb26b90..860ac30297 100644 --- a/config/common_modules/scripts.yml +++ b/config/common_modules/scripts.yml @@ -1,5 +1,6 @@ type: script scripts: + - ublue-update.sh - system76-scheduler.sh - brave-browser.sh - systemwide-themes.sh diff --git a/config/scripts/ublue-update.sh b/config/scripts/ublue-update.sh new file mode 100644 index 0000000000..f0ef5957be --- /dev/null +++ b/config/scripts/ublue-update.sh @@ -0,0 +1,31 @@ +#!/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 --prefix=/usr topgrade +rpm-ostree install ublue-update \ No newline at end of file