Fix scriptlet to reenable unit when obsolete wantedbys are removed.

This commit is contained in:
Manuel Amador (Rudd-O) 2025-02-27 00:05:40 +00:00
parent 86fa5c509c
commit 658e6dfa08
2 changed files with 22 additions and 4 deletions

View File

@ -3,7 +3,7 @@
%define mybuildnumber %{?build_number}%{?!build_number:1}
Name: qubes-network-server
Version: 0.1.5
Version: 0.1.6
Release: %{mybuildnumber}%{?dist}
Summary: Turn your Qubes OS into a network server
BuildArch: noarch
@ -90,11 +90,28 @@ tox --current-env
%{python3_sitelib}/qubesnetworkserver-*.egg-info
%post
# Remove old unit enablement paths.
rm -f %{_sysconfdir}/systemd/system/multi-user.target.wants/qubes-routing-manager.service || true
rm -f %{_sysconfdir}/systemd/system/qubes-iptables.service.wants/qubes-routing-manager.service || true
%systemd_post qubes-routing-manager.service
%posttrans
# Remove old unit enablement paths.
reenable=0
if [ -h %{_sysconfdir}/systemd/system/multi-user.target.wants/qubes-routing-manager.service ]
then
reenable=1
rm -f %{_sysconfdir}/systemd/system/multi-user.target.wants/qubes-routing-manager.service
fi
if [ -h %{_sysconfdir}/systemd/system/qubes-iptables.service.wants/qubes-routing-manager.service ]
then
reenable=1
rm -f %{_sysconfdir}/systemd/system/qubes-iptables.service.wants/qubes-routing-manager.service
fi
if [ $reenable = 1 ]
then
mkdir -p %{_sysconfdir}/systemd/system/qubes-network.service.wants
ln -sf %{_unitdir}/qubes-routing-manager.service %{_sysconfdir}/systemd/system/qubes-network.service.wants/qubes-routing-manager.service
fi
exit 0
%preun
%systemd_preun qubes-routing-manager.service

View File

@ -3,6 +3,7 @@ Description=Configure the network to allow network server VMs
Documentation=https://github.com/Rudd-O/qubes-network-server
After=qubes-network.service qubes-iptables.service
BindsTo=qubes-iptables.service
ConditionPathExists=/var/run/qubes-service/qubes-network
[Service]
Type=notify