From ddf8a9fd4c3db4340e160aba89bd2216be4a3d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 25 Jan 2025 22:28:56 +0100 Subject: [PATCH] vmupdate: help with migrating from pulseaudio to pipewire-pulse Pacman refuses this migration with non-interactive update. Help it a bit by removing pulseaudio beforehand. https://github.com/QubesOS/qubes-gui-agent-linux/pull/224 https://github.com/QubesOS/qubes-issues/issues/9660 --- .../source/plugins/pipewire_archlinux.py | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 vmupdate/agent/source/plugins/pipewire_archlinux.py diff --git a/vmupdate/agent/source/plugins/pipewire_archlinux.py b/vmupdate/agent/source/plugins/pipewire_archlinux.py new file mode 100644 index 0000000..ebf16d2 --- /dev/null +++ b/vmupdate/agent/source/plugins/pipewire_archlinux.py @@ -0,0 +1,47 @@ +# +# The Qubes OS Project, https://www.qubes-os.org/ +# +# Copyright (C) 2025 Marek Marczykowski-Górecki +# +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, see . + +import subprocess + +def pipewire_archlinux(os_data, log, **kwargs): + """Help with unattended switch from pulseaudio to pipewire-pulse""" + # pacman proposes to remove pulseaudio when installing pipewire-pulse, + # but the default answer is "n", so the update with --noconfirm fails + # workaround it by removing pulseaudio before the update + if os_data["os_family"] != 'ArchLinux': + return + # check if pulseaudio is installed + p = subprocess.call(["pacman", "-Q", "pulseaudio"], + stderr=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + ) + if p != 0: + return + # ... and whether pipewire-pulse is going to be installed in the update + # this will refresh metadata already, before starting progress reporting, + # but well... + update_list = subprocess.check_output(["pacman", "-Syup"], + stderr=subprocess.DEVNULL).decode() + if not any("/pipewire-pulse-" in line for line in update_list.splitlines()): + return + # ... then remove pulseaudio beforehand (temporarily breaking the + # dependencies) + log.info("Removing pulseaudio to allow update cleanly migrate to " + "pipewire-pulse") + subprocess.check_call(["pacman", "-Rdd", "--noconfirm", "pulseaudio"])