fedora: Add systemd drop-in support which include conditionals to prevent services from starting
Modified core-vm.spec to use drop-ins and removed old code that was using overrides
This commit is contained in:
parent
e8d45665f9
commit
9c53ed7d47
@ -77,27 +77,6 @@ BuildRequires: qubes-libvchan-%{backend_vmm}-devel
|
|||||||
|
|
||||||
%define kde_service_dir /usr/share/kde4/services
|
%define kde_service_dir /usr/share/kde4/services
|
||||||
|
|
||||||
%define installOverridenServices() \
|
|
||||||
UNITDIR=/lib/systemd/system\
|
|
||||||
OVERRIDEDIR=/usr/lib/qubes/init\
|
|
||||||
# Install overriden services only when original exists\
|
|
||||||
for srv in %*; do\
|
|
||||||
if [ -f $UNITDIR/$srv.service ]; then\
|
|
||||||
cp $OVERRIDEDIR/$srv.service /etc/systemd/system/\
|
|
||||||
/bin/systemctl is-enabled $srv.service >/dev/null && /bin/systemctl --no-reload reenable $srv.service 2>/dev/null\
|
|
||||||
fi\
|
|
||||||
if [ -f $UNITDIR/$srv.socket -a -f $OVERRIDEDIR/$srv.socket ]; then\
|
|
||||||
cp $OVERRIDEDIR/$srv.socket /etc/systemd/system/\
|
|
||||||
/bin/systemctl is-enabled $srv.socket >/dev/null && /bin/systemctl --no-reload reenable $srv.socket 2>/dev/null\
|
|
||||||
fi\
|
|
||||||
if [ -f $UNITDIR/$srv.path -a -f $OVERRIDEDIR/$srv.path ]; then\
|
|
||||||
cp $OVERRIDEDIR/$srv.path /etc/systemd/system/\
|
|
||||||
/bin/systemctl is-enabled $srv.path >/dev/null && /bin/systemctl --no-reload reenable $srv.path 2>/dev/null\
|
|
||||||
fi\
|
|
||||||
done\
|
|
||||||
/bin/systemctl daemon-reload\
|
|
||||||
%{nil}
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The Qubes core files for installation inside a Qubes VM.
|
The Qubes core files for installation inside a Qubes VM.
|
||||||
|
|
||||||
@ -139,14 +118,6 @@ usermod -L user
|
|||||||
(cd qrexec; make install DESTDIR=$RPM_BUILD_ROOT)
|
(cd qrexec; make install DESTDIR=$RPM_BUILD_ROOT)
|
||||||
make install-vm DESTDIR=$RPM_BUILD_ROOT
|
make install-vm DESTDIR=$RPM_BUILD_ROOT
|
||||||
|
|
||||||
# Create ghost files to silent rpmbuild warnings, those files will NOT be
|
|
||||||
# included in package
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/systemd/system
|
|
||||||
for f in ModemManager.service NetworkManager.service \
|
|
||||||
NetworkManager-wait-online.service cups.service cups.socket cups.path; do
|
|
||||||
cp $RPM_BUILD_ROOT/usr/lib/qubes/init/$f $RPM_BUILD_ROOT/etc/systemd/system/
|
|
||||||
done
|
|
||||||
|
|
||||||
cp -p $RPM_BUILD_ROOT/usr/lib/qubes/init/iptables $RPM_BUILD_ROOT/etc/sysconfig/iptables.qubes
|
cp -p $RPM_BUILD_ROOT/usr/lib/qubes/init/iptables $RPM_BUILD_ROOT/etc/sysconfig/iptables.qubes
|
||||||
cp -p $RPM_BUILD_ROOT/usr/lib/qubes/init/ip6tables $RPM_BUILD_ROOT/etc/sysconfig/ip6tables.qubes
|
cp -p $RPM_BUILD_ROOT/usr/lib/qubes/init/ip6tables $RPM_BUILD_ROOT/etc/sysconfig/ip6tables.qubes
|
||||||
|
|
||||||
@ -609,26 +580,31 @@ The Qubes core startup configuration for SystemD init.
|
|||||||
/usr/lib/qubes/init/misc-post-stop.sh
|
/usr/lib/qubes/init/misc-post-stop.sh
|
||||||
/usr/lib/qubes/init/mount-home.sh
|
/usr/lib/qubes/init/mount-home.sh
|
||||||
/usr/lib/qubes/init/qubes-sysinit.sh
|
/usr/lib/qubes/init/qubes-sysinit.sh
|
||||||
/usr/lib/qubes/init/ModemManager.service
|
%dir /lib/systemd/system/chronyd.service.d
|
||||||
/usr/lib/qubes/init/NetworkManager.service
|
%dir /lib/systemd/system/crond.service.d
|
||||||
/usr/lib/qubes/init/NetworkManager-wait-online.service
|
%dir /lib/systemd/system/cups.service.d
|
||||||
/usr/lib/qubes/init/cups.service
|
%dir /lib/systemd/system/cups.socket.d
|
||||||
/usr/lib/qubes/init/cups.socket
|
%dir /lib/systemd/system/cups.path.d
|
||||||
/usr/lib/qubes/init/cups.path
|
%dir /lib/systemd/system/getty@tty.service.d
|
||||||
/usr/lib/qubes/init/ntpd.service
|
%dir /lib/systemd/system/ModemManager.service.d
|
||||||
/usr/lib/qubes/init/chronyd.service
|
%dir /lib/systemd/system/NetworkManager.service.d
|
||||||
/usr/lib/qubes/init/crond.service
|
%dir /lib/systemd/system/NetworkManager-wait-online.service.d
|
||||||
%ghost %attr(0644,root,root) /etc/systemd/system/ModemManager.service
|
%dir /lib/systemd/system/ntpd.service.d
|
||||||
%ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager.service
|
/lib/systemd/system/chronyd.service.d/30_qubes.conf
|
||||||
%ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager-wait-online.service
|
/lib/systemd/system/crond.service.d/30_qubes.conf
|
||||||
%ghost %attr(0644,root,root) /etc/systemd/system/cups.service
|
/lib/systemd/system/cups.service.d/30_qubes.conf
|
||||||
%ghost %attr(0644,root,root) /etc/systemd/system/cups.socket
|
/lib/systemd/system/cups.socket.d/30_qubes.conf
|
||||||
%ghost %attr(0644,root,root) /etc/systemd/system/cups.path
|
/lib/systemd/system/cups.path.d/30_qubes.conf
|
||||||
|
/lib/systemd/system/getty@tty.service.d/30_qubes.conf
|
||||||
|
/lib/systemd/system/ModemManager.service.d/30_qubes.conf
|
||||||
|
/lib/systemd/system/NetworkManager.service.d/30_qubes.conf
|
||||||
|
/lib/systemd/system/NetworkManager-wait-online.service.d/30_qubes.conf
|
||||||
|
/lib/systemd/system/ntpd.service.d/30_qubes.conf
|
||||||
|
|
||||||
%post systemd
|
%post systemd
|
||||||
|
|
||||||
if [ $1 -eq 1 ]; then
|
if [ $1 -eq 1 ]; then
|
||||||
/bin/systemctl --no-reload preset-all
|
/bin/systemctl --no-reload preset-all > /dev/null 2>&1 && PRESET_FAILED=0 || PRESET_FAILED=1
|
||||||
else
|
else
|
||||||
services="qubes-dvm qubes-misc-post qubes-firewall qubes-mount-home"
|
services="qubes-dvm qubes-misc-post qubes-firewall qubes-mount-home"
|
||||||
services="$services qubes-netwatcher qubes-network qubes-sysinit"
|
services="$services qubes-netwatcher qubes-network qubes-sysinit"
|
||||||
@ -653,35 +629,19 @@ grep '^[[:space:]]*[^#;]' /lib/systemd/system-preset/75-qubes-vm.preset | while
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
# preset-all is not available in fc20; so preset each unit file listed in 75-qubes-vm.preset
|
||||||
|
if [ "${PRESET_FAILED}" -eq 1 ]; then
|
||||||
|
systemctl --no-reload preset "${unit_name}" > /dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f /etc/systemd/system/getty.target.wants/getty@tty*.service
|
|
||||||
|
|
||||||
/bin/systemctl daemon-reload
|
/bin/systemctl daemon-reload
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%triggerin systemd -- NetworkManager
|
|
||||||
%installOverridenServices ModemManager NetworkManager NetworkManager-wait-online
|
|
||||||
# Disable D-BUS activation of NetworkManager - in AppVm it causes problems (eg PackageKit timeouts)
|
|
||||||
/bin/systemctl mask dbus-org.freedesktop.NetworkManager.service 2> /dev/null
|
|
||||||
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=974811
|
|
||||||
/bin/systemctl enable NetworkManager-dispatcher.service 2> /dev/null
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
%triggerin systemd -- cups
|
|
||||||
%installOverridenServices cups
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
%triggerin systemd -- cronie
|
|
||||||
%installOverridenServices crond
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
%triggerin systemd -- chrony
|
|
||||||
%installOverridenServices chronyd
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
%postun systemd
|
%postun systemd
|
||||||
|
|
||||||
#Do not run this part on upgrades
|
#Do not run this part on upgrades
|
||||||
|
Loading…
Reference in New Issue
Block a user