Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/379'
Browse files Browse the repository at this point in the history
* origin/pr/379:
  makefile: Fix *_DROPIN_DIR variables
  Disable pipewire by default
  • Loading branch information
marmarek committed May 4, 2022
2 parents cbe782b + bdd14fe commit dcfb760
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 19 deletions.
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ clean:
rm -f .coverage

# Dropin Directory
SYSTEM_DROPIN_DIR ?= "lib/systemd/system"
USER_DROPIN_DIR ?= "usr/lib/systemd/user"
SYSTEM_DROPIN_DIR ?= /lib/systemd/system
USER_DROPIN_DIR ?= /usr/lib/systemd/user

SYSTEM_DROPINS := boot.automount chronyd.service crond.service
SYSTEM_DROPINS += cups.service cups-browsed.service cups.path cups.socket ModemManager.service
Expand Down Expand Up @@ -76,23 +76,23 @@ endif
install-systemd-dropins:
# Install system dropins
@for dropin in $(SYSTEM_DROPINS); do \
install -d $(DESTDIR)/$(SYSTEM_DROPIN_DIR)/$${dropin}.d ;\
install -m 0644 vm-systemd/$${dropin}.d/*.conf $(DESTDIR)/$(SYSTEM_DROPIN_DIR)/$${dropin}.d/ ;\
install -d $(DESTDIR)$(SYSTEM_DROPIN_DIR)/$${dropin}.d ;\
install -m 0644 vm-systemd/$${dropin}.d/*.conf $(DESTDIR)$(SYSTEM_DROPIN_DIR)/$${dropin}.d/ ;\
done
install -d $(DESTDIR)/$(SYSTEM_DROPIN_DIR)/sysinit.target.requires
ln -sf ../systemd-random-seed.service $(DESTDIR)/$(SYSTEM_DROPIN_DIR)/sysinit.target.requires
install -d $(DESTDIR)$(SYSTEM_DROPIN_DIR)/sysinit.target.requires
ln -sf ../systemd-random-seed.service $(DESTDIR)$(SYSTEM_DROPIN_DIR)/sysinit.target.requires

# Install user dropins
@for dropin in $(USER_DROPINS); do \
install -d $(DESTDIR)/$(USER_DROPIN_DIR)/$${dropin}.d ;\
install -m 0644 vm-systemd/user/$${dropin}.d/*.conf $(DESTDIR)/$(USER_DROPIN_DIR)/$${dropin}.d/ ;\
install -d $(DESTDIR)$(USER_DROPIN_DIR)/$${dropin}.d ;\
install -m 0644 vm-systemd/user/$${dropin}.d/*.conf $(DESTDIR)$(USER_DROPIN_DIR)/$${dropin}.d/ ;\
done

install-systemd-networking-dropins:
# Install system dropins
@for dropin in $(SYSTEM_DROPINS_NETWORKING); do \
install -d $(DESTDIR)/$(SYSTEM_DROPIN_DIR)/$${dropin}.d ;\
install -m 0644 vm-systemd/$${dropin}.d/*.conf $(DESTDIR)/$(SYSTEM_DROPIN_DIR)/$${dropin}.d/ ;\
install -d $(DESTDIR)$(SYSTEM_DROPIN_DIR)/$${dropin}.d ;\
install -m 0644 vm-systemd/$${dropin}.d/*.conf $(DESTDIR)$(SYSTEM_DROPIN_DIR)/$${dropin}.d/ ;\
done

install-init:
Expand All @@ -112,6 +112,8 @@ install-systemd: install-init
install -m 0644 $(SYSTEMD_CORE_SERVICES) $(DESTDIR)$(SYSLIBDIR)/systemd/system/
install -m 0644 vm-systemd/qubes-*.timer $(DESTDIR)$(SYSLIBDIR)/systemd/system/
install -m 0644 vm-systemd/75-qubes-vm.preset $(DESTDIR)$(SYSLIBDIR)/systemd/system-preset/
install -D -m 0644 vm-systemd/75-qubes-vm.user-preset \
$(DESTDIR)$(USER_DROPIN_DIR)-preset/75-qubes-vm.preset
install -m 0644 vm-systemd/qubes-core.conf $(DESTDIR)$(SYSLIBDIR)/modules-load.d/
install -m 0644 vm-systemd/xendriverdomain.service $(DESTDIR)/etc/systemd/system/
install -m 0644 vm-systemd/80-qubes-vif.link $(DESTDIR)$(SYSLIBDIR)/systemd/network/
Expand Down
17 changes: 13 additions & 4 deletions archlinux/PKGBUILD.install
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ EOF
############################
## Service Management Functions ##
############################
# FIXME: add user units support to is_static()/is_masked()/mask()/unmask() functions
is_static() {
[ -f "/usr/lib/systemd/system/$1" ] && ! grep -q '^[[].nstall]' "/usr/lib/systemd/system/$1"
}
Expand Down Expand Up @@ -166,6 +167,8 @@ unmask() {

preset_units() {
local represet=
# shellcheck disable=SC2206
local extra_opts=( $3 )
while read -r action unit_name
do
if [ "$action" = "#" ] && [ "$unit_name" = "Units below this line will be re-preset on package upgrade" ]
Expand All @@ -191,15 +194,17 @@ preset_units() {
# We masked this static unit before, now we unmask it.
unmask "$unit_name"
fi
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
else
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
fi
fi
done < "$1"
}

restore_units() {
# shellcheck disable=SC2206
local extra_opts=( $2 )
grep '^[[:space:]]*[^#;]' "$1" | while read -r action unit_name
do
if is_static "$unit_name" && is_masked "$unit_name"
Expand All @@ -208,17 +213,19 @@ restore_units() {
# Otherwise systemctl preset will fail badly.
unmask "$unit_name"
fi
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
done
}

configure_systemd() {
if [ "$1" -eq 1 ]
then
preset_units /usr/lib/systemd/system-preset/$qubes_preset_file initial
preset_units /usr/lib/systemd/user-preset/$qubes_preset_file initial --global
changed=true
else
preset_units /usr/lib/systemd/system-preset/$qubes_preset_file upgrade
preset_units /usr/lib/systemd/user-preset/$qubes_preset_file upgrade --global
changed=true
# Upgrade path - now qubes-iptables is used instead
for svc in iptables ip6tables
Expand Down Expand Up @@ -399,7 +406,8 @@ pre_remove() {
# once the Qubes OS preset file is removed.
mkdir -p /run/qubes-uninstall
cp -f /usr/lib/systemd/system-preset/$qubes_preset_file /run/qubes-uninstall/
cp -f /usr/lib/systemd/system-preset/$qubes_preset_file /run/qubes-uninstall/
cp -f /usr/lib/systemd/user-preset/$qubes_preset_file \
/run/qubes-uninstall/user-$qubes_preset_file
fi
}

Expand All @@ -412,6 +420,7 @@ post_remove() {
# We have a saved preset file (or more).
# Re-preset the units mentioned there.
restore_units /run/qubes-uninstall/$qubes_preset_file
restore_units /run/qubes-uninstall/user-$qubes_preset_file --global
rm -rf /run/qubes-uninstall
changed=true
fi
Expand Down
1 change: 1 addition & 0 deletions debian/qubes-core-agent.install
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ usr/lib/qubes/xdg-icon
usr/lib/qubes/tinyproxy-wrapper
usr/lib/systemd/user/pulseaudio.service.d/30_qubes.conf
usr/lib/systemd/user/pulseaudio.socket.d/30_qubes.conf
usr/lib/systemd/user-preset/75-qubes-vm.preset
usr/share/glib-2.0/schemas/*
usr/share/kde4/services/*.desktop
usr/share/kservices5/ServiceMenus/*.desktop
Expand Down
9 changes: 7 additions & 2 deletions debian/qubes-core-agent.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ debug() {
fi
}

# FIXME: add user units support to is_static()/is_masked()/mask()/unmask() functions
is_static() {
[ -f "/lib/systemd/system/$1" ] && ! grep -q '^[[].nstall]' "/lib/systemd/system/$1"
}
Expand Down Expand Up @@ -57,6 +58,8 @@ unmask() {

preset_units() {
local represet=
# shellcheck disable=SC2206
local extra_opts=( $3 )
while read -r action unit_name
do
if [ "$action" = "#" ] && [ "$unit_name" = "Units below this line will be re-preset on package upgrade" ]
Expand Down Expand Up @@ -84,9 +87,9 @@ preset_units() {
# We masked this static unit before, now we unmask it.
deb-systemd-helper unmask "${unit_name}" > /dev/null 2>&1 || true
fi
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
else
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || :
systemctl --no-reload "${extra_opts[@]}" preset "$unit_name" >/dev/null 2>&1 || :
fi
fi
done < "$1"
Expand Down Expand Up @@ -137,11 +140,13 @@ case "${1}" in

# Systemd preload-all
preset_units /lib/systemd/system-preset/75-qubes-vm.preset initial
preset_units /usr/lib/systemd/user-preset/75-qubes-vm.preset initial --global

# Maybe install overridden serial.conf init script
installSerialConf
else
preset_units /lib/systemd/system-preset/75-qubes-vm.preset upgrade
preset_units /usr/lib/systemd/user-preset/75-qubes-vm.preset upgrade --global
fi
systemctl reenable haveged

Expand Down
15 changes: 12 additions & 3 deletions rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
%define plateform_python3_sitelib %(/usr/libexec/platform-python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
%endif

# FIXME: add user units support to is_static()/is_masked()/mask()/unmask() functions
%define scriptletfuns is_static() { \
[ -f "%{_unitdir}/$1" ] && ! grep -q '^[[].nstall]' "%{_unitdir}/$1" \
} \
Expand Down Expand Up @@ -65,6 +66,7 @@ unmask() { \
\
preset_units() { \
local represet= \
local extra_opts="$3" \
cat "$1" | while read action unit_name \
do \
if [ "$action" = "#" -a "$unit_name" = "Units below this line will be re-preset on package upgrade" ] \
Expand All @@ -90,15 +92,16 @@ preset_units() { \
# We masked this static unit before, now we unmask it. \
unmask "$unit_name" \
fi \
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
systemctl --no-reload $extra_opts preset "$unit_name" >/dev/null 2>&1 || : \
else \
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
systemctl --no-reload $extra_opts preset "$unit_name" >/dev/null 2>&1 || : \
fi \
fi \
done \
} \
\
restore_units() { \
local extra_opts="$2" \
grep '^[[:space:]]*[^#;]' "$1" | while read action unit_name \
do \
if is_static "$unit_name" && is_masked "$unit_name" \
Expand All @@ -107,7 +110,7 @@ restore_units() { \
# Otherwise systemctl preset will fail badly. \
unmask "$unit_name" \
fi \
systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
systemctl --no-reload $extra_opts preset "$unit_name" >/dev/null 2>&1 || : \
done \
} \

Expand Down Expand Up @@ -958,6 +961,7 @@ The Qubes core startup configuration for SystemD init.
/usr/lib/systemd/system/[email protected]
/usr/lib/systemd/system/qubes-updates-proxy-forwarder.socket
/usr/lib/systemd/system-preset/%qubes_preset_file
/usr/lib/systemd/user-preset/%qubes_preset_file
/usr/lib/modules-load.d/qubes-core.conf
/usr/lib/systemd/system/boot.automount.d/30_qubes.conf
/usr/lib/systemd/system/chronyd.service.d/30_qubes.conf
Expand Down Expand Up @@ -994,9 +998,11 @@ changed=
if [ $1 -eq 1 ]
then
preset_units %{_presetdir}/%qubes_preset_file initial
preset_units %{%_userpresetdir}/%qubes_preset_file initial --global
changed=true
else
preset_units %{_presetdir}/%qubes_preset_file upgrade
preset_units %{_userpresetdir}/%qubes_preset_file upgrade --global
changed=true
# Upgrade path - now qubes-iptables is used instead
for svc in iptables ip6tables
Expand Down Expand Up @@ -1046,6 +1052,8 @@ if [ $1 -eq 0 ] ; then
# once the Qubes OS preset file is removed.
mkdir -p %{_rundir}/qubes-uninstall
cp -f %{_presetdir}/%qubes_preset_file %{_rundir}/qubes-uninstall/
cp -f %{_userpresetdir}/%qubes_preset_file \
%{_rundir}/qubes-uninstall/user-%qubes_preset_file
fi

%postun systemd
Expand All @@ -1059,6 +1067,7 @@ then
# We have a saved preset file (or more).
# Re-preset the units mentioned there.
restore_units %{_rundir}/qubes-uninstall/%qubes_preset_file
restore_units %{_rundir}/qubes-uninstall/user-%qubes_preset_file --global
rm -rf %{_rundir}/qubes-uninstall
changed=true
fi
Expand Down
7 changes: 7 additions & 0 deletions vm-systemd/75-qubes-vm.user-preset
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# Units below this line will be re-preset on package upgrade

# conflicts with pulseaudio
disable pipewire.socket
disable pipewire.service
disable wireplumber.service

0 comments on commit dcfb760

Please sign in to comment.