Skip to content

Commit ddf8a9f

Browse files
committed
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. QubesOS/qubes-gui-agent-linux#224 QubesOS/qubes-issues#9660
1 parent e01384b commit ddf8a9f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#
2+
# The Qubes OS Project, https://www.qubes-os.org/
3+
#
4+
# Copyright (C) 2025 Marek Marczykowski-Górecki
5+
6+
#
7+
# This library is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public
9+
# License as published by the Free Software Foundation; either
10+
# version 2 of the License, or (at your option) any later version.
11+
#
12+
# This library is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
# Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public
18+
# License along with this library; if not, see <https://www.gnu.org/licenses/>.
19+
20+
import subprocess
21+
22+
def pipewire_archlinux(os_data, log, **kwargs):
23+
"""Help with unattended switch from pulseaudio to pipewire-pulse"""
24+
# pacman proposes to remove pulseaudio when installing pipewire-pulse,
25+
# but the default answer is "n", so the update with --noconfirm fails
26+
# workaround it by removing pulseaudio before the update
27+
if os_data["os_family"] != 'ArchLinux':
28+
return
29+
# check if pulseaudio is installed
30+
p = subprocess.call(["pacman", "-Q", "pulseaudio"],
31+
stderr=subprocess.DEVNULL,
32+
stdout=subprocess.DEVNULL,
33+
)
34+
if p != 0:
35+
return
36+
# ... and whether pipewire-pulse is going to be installed in the update
37+
# this will refresh metadata already, before starting progress reporting,
38+
# but well...
39+
update_list = subprocess.check_output(["pacman", "-Syup"],
40+
stderr=subprocess.DEVNULL).decode()
41+
if not any("/pipewire-pulse-" in line for line in update_list.splitlines()):
42+
return
43+
# ... then remove pulseaudio beforehand (temporarily breaking the
44+
# dependencies)
45+
log.info("Removing pulseaudio to allow update cleanly migrate to "
46+
"pipewire-pulse")
47+
subprocess.check_call(["pacman", "-Rdd", "--noconfirm", "pulseaudio"])

0 commit comments

Comments
 (0)