diff --git a/files/etc/ublue-update.d/system/00-system-update.py b/files/etc/ublue-update.d/system/00-system-update.py index eb3e399..e08da3d 100755 --- a/files/etc/ublue-update.d/system/00-system-update.py +++ b/files/etc/ublue-update.d/system/00-system-update.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/python3 from subprocess import run from json import loads, load @@ -106,7 +106,7 @@ def check_for_rebase(): else: print("rebase failed!, command output:") print(rebase_out.stdout.decode("utf-8")) - update_cmd = ["rpm-ostree", "upgrade"] + update_cmd = ["/usr/bin/topgrade", "--config", "/etc/ublue-update/topgrade-system.toml"] update_out = run(update_cmd, capture_output=True) if update_out.returncode != 0: print( diff --git a/files/etc/ublue-update.d/system/01-flatpak-system-update.sh b/files/etc/ublue-update.d/system/01-flatpak-system-update.sh deleted file mode 100755 index cba7208..0000000 --- a/files/etc/ublue-update.d/system/01-flatpak-system-update.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -/usr/bin/flatpak --system update -y --noninteractive diff --git a/files/etc/ublue-update.d/system/02-flatpak-system-repair-cleanup.sh b/files/etc/ublue-update.d/system/02-flatpak-system-repair-cleanup.sh deleted file mode 100755 index b10acc8..0000000 --- a/files/etc/ublue-update.d/system/02-flatpak-system-repair-cleanup.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -/usr/bin/flatpak uninstall --system --unused -y --noninteractive -/usr/bin/flatpak repair --system diff --git a/files/etc/ublue-update.d/user/00-flatpak-user-update.sh b/files/etc/ublue-update.d/user/00-flatpak-user-update.sh deleted file mode 100755 index 76d3b79..0000000 --- a/files/etc/ublue-update.d/user/00-flatpak-user-update.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -/usr/bin/flatpak --user update -y --noninteractive diff --git a/files/etc/ublue-update.d/user/01-flatpak-user-repair-cleanup.sh b/files/etc/ublue-update.d/user/01-flatpak-user-repair-cleanup.sh deleted file mode 100755 index 8046e76..0000000 --- a/files/etc/ublue-update.d/user/01-flatpak-user-repair-cleanup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - - -/usr/bin/flatpak uninstall --user --unused -y --noninteractive -/usr/bin/flatpak repair --user diff --git a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh b/files/etc/ublue-update.d/user/02-distrobox-user-update.sh deleted file mode 100755 index a45075b..0000000 --- a/files/etc/ublue-update.d/user/02-distrobox-user-update.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -if [ -x /usr/bin/distrobox ]; then - unset SUDO_USER # avoid distrobox sudo checks - /usr/bin/distrobox upgrade -a -fi diff --git a/files/etc/ublue-update.d/user/03-fleek-user-update.sh b/files/etc/ublue-update.d/user/03-fleek-user-update.sh deleted file mode 100755 index c322993..0000000 --- a/files/etc/ublue-update.d/user/03-fleek-user-update.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -if [ -x /var/usrlocal/bin/fleek ]; then - /var/usrlocal/bin/fleek update -a -fi diff --git a/files/etc/ublue-update.d/user/04-brew-update.sh b/files/etc/ublue-update.d/user/04-brew-update.sh deleted file mode 100644 index cb61d0f..0000000 --- a/files/etc/ublue-update.d/user/04-brew-update.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -if command -v /var/home/linuxbrew/.linuxbrew/bin/brew; then - /var/home/linuxbrew/.linuxbrew/bin/brew update --auto-update -fi diff --git a/files/usr/etc/ublue-update/topgrade-system.toml b/files/usr/etc/ublue-update/topgrade-system.toml new file mode 100644 index 0000000..9c74827 --- /dev/null +++ b/files/usr/etc/ublue-update/topgrade-system.toml @@ -0,0 +1,10 @@ +[misc] +only = ["system", "flatpak"] +ignore_failures = ["flatpak"] +skip_notify = true +assume_yes = true +no_retry = true +no_self_update = true + +[linux] +rpm_ostree = true diff --git a/files/usr/etc/ublue-update/topgrade-user.toml b/files/usr/etc/ublue-update/topgrade-user.toml new file mode 100644 index 0000000..a83ac17 --- /dev/null +++ b/files/usr/etc/ublue-update/topgrade-user.toml @@ -0,0 +1,13 @@ +[misc] +only = ["flatpak", "distrobox"] +ignore_failures = ["flatpak", "distrobox"] +skip_notify = true +assume_yes = true +no_retry = true +no_self_update = true + +[distrobox] +use_root = false + +[flatpak] +use_sudo = false diff --git a/src/ublue_update/cli.py b/src/ublue_update/cli.py index a8e501e..1f4ea06 100644 --- a/src/ublue_update/cli.py +++ b/src/ublue_update/cli.py @@ -160,8 +160,9 @@ def run_updates(system, system_update_available): "DISPLAY=:0", f"XDG_RUNTIME_DIR={xdg_runtime_dir}", f"DBUS_SESSION_BUS_ADDRESS=unix:path={xdg_runtime_dir}/bus", - "/usr/bin/ublue-update", - "-f", + "/usr/bin/topgrade", + "--config", + "/etc/ublue-update/topgrade-user.toml", ], capture_output=True, ) @@ -181,7 +182,6 @@ def run_updates(system, system_update_available): raise Exception( "ublue-update needs to be run as root to perform system updates!" ) - run_update_scripts(f"{root_dir}/user/") release_lock(fd) os._exit(0) diff --git a/ublue-update.spec b/ublue-update.spec index 1717145..e1822bb 100644 --- a/ublue-update.spec +++ b/ublue-update.spec @@ -18,7 +18,6 @@ Supplements: rpm-ostree flatpak BuildRequires: make BuildRequires: systemd-rpm-macros BuildRequires: black -BuildRequires: ShellCheck BuildRequires: python-flake8 BuildRequires: python-build BuildRequires: python-setuptools @@ -45,8 +44,6 @@ ls ls src black src flake8 src -shellcheck files/etc/%{NAME}.d/user/*.sh -shellcheck files/etc/%{NAME}.d/system/*.sh black files/etc/%{NAME}.d/system/*.py flake8 files/etc/%{NAME}.d/system/*.py %pyproject_wheel @@ -56,6 +53,13 @@ flake8 files/etc/%{NAME}.d/system/*.py %pyproject_save_files ublue_update cp -rp files/etc files/usr %{buildroot} +%pre +if [ ! -x /usr/bin/topgrade ] +then + echo "Topgrade not installed. Please install Topgrade (https://github.com/topgrade-rs/topgrade) to use %{name}." + exit 1 +fi + %post %systemd_post %{NAME}.timer @@ -67,8 +71,7 @@ cp -rp files/etc files/usr %{buildroot} %attr(0644,root,root) %{_exec_prefix}/lib/systemd/system/%{NAME}.service %attr(0644,root,root) %{_exec_prefix}/lib/systemd/system/%{NAME}.timer %attr(0644,root,root) %{_exec_prefix}/lib/systemd/system-preset/00-%{NAME}.preset -%attr(0644,root,root) %{_exec_prefix}/etc/%{NAME}/%{NAME}.toml -%attr(0755,root,root) %{_sysconfdir}/%{NAME}.d/user/* +%attr(0644,root,root) %{_exec_prefix}/etc/%{NAME}/*.toml %attr(0755,root,root) %{_sysconfdir}/%{NAME}.d/system/* %attr(0644,root,root) %{_exec_prefix}/etc/polkit-1/rules.d/%{NAME}.rules