From e4264f4917edd02db3300771e84c7f0b5a8d8e4e Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Wed, 13 Mar 2013 06:14:07 +0100 Subject: [PATCH] Remove SysV-init scripts Now dom0 uses SystemD, so init.d scripts no longer needed. --- dom0/init.d/qubes_core | 79 ---------------------------------- dom0/init.d/qubes_netvm | 87 -------------------------------------- dom0/init.d/qubes_setupdvm | 69 ------------------------------ rpm_spec/core-dom0.spec | 49 --------------------- 4 files changed, 284 deletions(-) delete mode 100755 dom0/init.d/qubes_core delete mode 100755 dom0/init.d/qubes_netvm delete mode 100755 dom0/init.d/qubes_setupdvm diff --git a/dom0/init.d/qubes_core b/dom0/init.d/qubes_core deleted file mode 100755 index 1da7e867..00000000 --- a/dom0/init.d/qubes_core +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# -# chkconfig: 2345 80 00 -# description: Executes Qubes core scripts at Dom0 boot -# -### BEGIN INIT INFO -# Provides: qubes-core -# Required-Start: xend -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Default-Enabled: yes -# Short-Description: Start/stop qubes-core services -# Description: Starts and stops the qubes-core serives -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - - -start() -{ - echo -n $"Executing Qubes Core scripts:" - modprobe evtchn 2> /dev/null || modprobe xen-evtchn - /usr/lib/qubes/fix_dir_perms.sh - - xenstore-write /local/domain/0/name dom0 - DOM0_MAXMEM=`/usr/sbin/xl info | grep total_memory | awk '{ print $3 }'` - xenstore-write /local/domain/0/memory/static-max $[ $DOM0_MAXMEM * 1024 ] - - xl sched-credit -d 0 -w 512 - cp /var/lib/qubes/qubes.xml /var/lib/qubes/backup/qubes-$(date +%F-%T).xml - - /usr/lib/qubes/cleanup_dispvms - - /usr/lib/qubes/qmemman_daemon.py - MEM_CHANGE_THRESHOLD_KB=30000 - MEMINFO_DELAY_USEC=100000 - /usr/lib/qubes/meminfo-writer $MEM_CHANGE_THRESHOLD_KB $MEMINFO_DELAY_USEC - - /usr/lib/qubes/block_cleaner_daemon.py > /var/log/qubes/block_cleaner.log 2>&1 & - - # Hide mounted devices from qubes-block list (at first udev run, only / is mounted) - for dev in `xenstore-list /local/domain/0/qubes-block-devices 2> /dev/null`; do - ( eval `udevadm info -q property -n $dev|sed -e 's/\([^=]*\)=\(.*\)/export \1="\2"/'`; - /usr/lib/qubes/block_add_change > /dev/null - ) - done - - touch /var/lock/subsys/qubes_core - success - echo - -} - -stop() -{ - echo -n $"Shutting down all Qubes VMs:" - qvm-shutdown -q --all --wait - rm -f /var/lock/subsys/qubes_core - killall meminfo-writer - killall qmemman_daemon.py - success - echo -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - *) - echo $"Usage: $0 {start|stop}" - exit 3 - ;; -esac - -exit $RETVAL diff --git a/dom0/init.d/qubes_netvm b/dom0/init.d/qubes_netvm deleted file mode 100755 index 3e4d902b..00000000 --- a/dom0/init.d/qubes_netvm +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -# -# chkconfig: 2345 81 00 -# description: Starts/stops Qubes default netvm -# -### BEGIN INIT INFO -# Provides: qubes-networking -# Required-Start: qubes-core -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Default-Enabled: yes -# Short-Description: Start/stop qubes networking -# Description: Starts and stops the qubes networking -### END INIT INFO - - -# -# Source function library. -. /etc/rc.d/init.d/functions - -NETVM=$(qubes-prefs --get default-netvm) - -get_running_netvms() { - # Actually get running VMs with PCI devices attached - RUNNING_VMS=`xl list | tail -n +3 | cut -f 1 -d " "` - RUNNING_NETVMS="" - for VM in $RUNNING_VMS; do - if [ -n "`xl pci-list $VM`" ]; then - echo "$VM" - fi - done -} - -start() -{ - if [ x$NETVM = x ] ; then - - echo WARNING: Qubes NetVM not configured! - echo -n $"Doing nothing:" - - else - - echo -n $"Starting default NetVM:" - DISPLAY=:0 sg qubes "qvm-start -q --no-guid $NETVM" || exit 1 - - fi - touch /var/lock/subsys/qubes_netvm - success - echo - return 0 -} - -stop() -{ - if [ x$NETVM = x ] ; then - - echo WARNING: Qubes NetVM not configured! - echo -n $"Doing nothing:" - - else - echo -n $"Stopping NetVMs:" - for VM in `get_running_netvms`; do - qvm-shutdown -q --force --wait $VM - done - - fi - rm -f /var/lock/subsys/qubes_netvm - success - echo - - return 0 -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - *) - echo $"Usage: $0 {start|stop}" - exit 3 - ;; -esac - -exit $RETVAL diff --git a/dom0/init.d/qubes_setupdvm b/dom0/init.d/qubes_setupdvm deleted file mode 100755 index 7a6875eb..00000000 --- a/dom0/init.d/qubes_setupdvm +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -# -# chkconfig: 2345 82 00 -# description: Sets up DVM savefile at Dom0 boot -# -### BEGIN INIT INFO -# Provides: qubes-dvm -# Required-Start: qubes-networking -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Default-Enabled: yes -# Short-Description: Sets up DVM savefile at Dom0 boot -# Description: Sets up DVM savefile at Dom0 boot -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -start() -{ - echo -n "Setting up DVM savefile at Dom0 boot:" - - printf "\x00\x00\x00\x00" > /var/run/qubes/dispVM_seq - chown root:qubes /var/run/qubes/dispVM_seq - chmod 660 /var/run/qubes/dispVM_seq - DEFAULT=/var/lib/qubes/dvmdata/default_savefile - DEFAULT_CONFIG=/var/lib/qubes/dvmdata/default_dvm.conf - # setup DispVM files only when they exists - if [ -r $DEFAULT ]; then - ln -s $DEFAULT_CONFIG /var/run/qubes/current_dvm.conf - if [ -f /var/lib/qubes/dvmdata/dont_use_shm ] ; then - ln -s $DEFAULT /var/run/qubes/current_savefile - else - mkdir -m 770 /dev/shm/qubes - chown root.qubes /dev/shm/qubes - cp -a $(readlink $DEFAULT) /dev/shm/qubes/current_savefile - chown root.qubes /dev/shm/qubes/current_savefile - chmod 660 /dev/shm/qubes/current_savefile - ln -s /dev/shm/qubes/current_savefile /var/run/qubes/current_savefile - fi - fi - - touch /var/lock/subsys/qubes_setupdvm - success - echo - -} - -stop() -{ - rm -f /var/lock/subsys/qubes_setupdvm - success - echo -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - *) - echo $"Usage: $0 {start|stop}" - exit 3 - ;; -esac - -exit $RETVAL diff --git a/rpm_spec/core-dom0.spec b/rpm_spec/core-dom0.spec index 94d82317..d64fe82f 100644 --- a/rpm_spec/core-dom0.spec +++ b/rpm_spec/core-dom0.spec @@ -27,12 +27,6 @@ %{!?version: %define version %(cat version)} -%if %{fedora} >= 15 -%{!?use_systemd: %define use_systemd 1} -%else -%{!?use_systemd: %define use_systemd 0} -%endif - %define _dracutmoddir /usr/lib/dracut/modules.d %if %{fedora} < 17 %define _dracutmoddir /usr/share/dracut/modules.d @@ -49,12 +43,10 @@ License: GPL URL: http://www.qubes-os.org BuildRequires: xen-devel BuildRequires: ImageMagick -%if %{use_systemd} BuildRequires: systemd-units Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units -%endif Requires: python, xen-runtime, pciutils, python-inotify, python-daemon, kernel-qubes-dom0 Requires: qubes-qrexec-dom0 Requires: python-lxml @@ -93,13 +85,6 @@ done cd dom0 -%if !%{use_systemd} -mkdir -p $RPM_BUILD_ROOT/etc/init.d -cp init.d/qubes_core $RPM_BUILD_ROOT/etc/init.d/ -cp init.d/qubes_netvm $RPM_BUILD_ROOT/etc/init.d/ -cp init.d/qubes_setupdvm $RPM_BUILD_ROOT/etc/init.d/ -%else - mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system cp systemd/qubes-block-cleaner.service $RPM_BUILD_ROOT%{_unitdir} cp systemd/qubes-core.service $RPM_BUILD_ROOT%{_unitdir} @@ -107,7 +92,6 @@ cp systemd/qubes-setupdvm.service $RPM_BUILD_ROOT%{_unitdir} cp systemd/qubes-meminfo-writer.service $RPM_BUILD_ROOT%{_unitdir} cp systemd/qubes-netvm.service $RPM_BUILD_ROOT%{_unitdir} cp systemd/qubes-qmemman.service $RPM_BUILD_ROOT%{_unitdir} -%endif mkdir -p $RPM_BUILD_ROOT/usr/bin/ cp qvm-tools/qvm-* $RPM_BUILD_ROOT/usr/bin @@ -276,7 +260,6 @@ echo XENCONSOLED_LOG_HYPERVISOR=yes >> /etc/sysconfig/xenconsoled echo XENCONSOLED_LOG_GUESTS=yes >> /etc/sysconfig/xenconsoled -%if %{use_systemd} systemctl --no-reload enable qubes-core.service >/dev/null 2>&1 systemctl --no-reload enable qubes-netvm.service >/dev/null 2>&1 systemctl --no-reload enable qubes-setupdvm.service >/dev/null 2>&1 @@ -286,22 +269,6 @@ systemctl --no-reload disable xend.service >/dev/null 2>&1 systemctl --no-reload disable xendomains.service >/dev/null 2>&1 systemctl demon-reload >/dev/null 2>&1 || : -%else - -chkconfig --add qubes_core || echo "WARNING: Cannot add service qubes_core!" -chkconfig --add qubes_netvm || echo "WARNING: Cannot add service qubes_netvm!" -chkconfig --add qubes_setupdvm || echo "WARNING: Cannot add service qubes_setupdvm!" - -chkconfig --level 5 qubes_core on || echo "WARNING: Cannot enable service qubes_core!" -chkconfig --level 5 qubes_netvm on || echo "WARNING: Cannot enable service qubes_netvm!" -chkconfig --level 5 qubes_setupdvm on || echo "WARNING: Cannot enable service qubes_setupdvm!" - -# Conflicts with libxl stack, so disable it -service xend stop -chkconfig --level 5 xend off - -%endif - HAD_SYSCONFIG_NETWORK=yes if ! [ -e /etc/sysconfig/network ]; then HAD_SYSCONFIG_NETWORK=no @@ -345,15 +312,6 @@ if ! grep -q ^qubes: /etc/group ; then groupadd qubes fi -#if [ "$1" -gt 1 ] ; then - # upgrading already installed package... - -# Do not restart core during upgrade -# most upgrades only modifies qvm-* tools -# and it makes no sense to force all VMs shutdown -# /etc/init.d/qubes_core stop -#fi - %triggerin -- xen %triggerin -- xen-runtime @@ -391,11 +349,6 @@ fi %files %defattr(-,root,root,-) -%if !%{use_systemd} -/etc/init.d/qubes_core -/etc/init.d/qubes_netvm -/etc/init.d/qubes_setupdvm -%endif %config(noreplace) %attr(0664,root,qubes) %{_sysconfdir}/qubes/qmemman.conf /usr/bin/qvm-* /usr/bin/qubes-* @@ -440,14 +393,12 @@ fi /usr/lib/qubes/startup-misc.sh /usr/lib/qubes/prepare_volatile_img.sh %attr(4750,root,qubes) /usr/lib/qubes/qfile-dom0-unpacker -%if %{use_systemd} %{_unitdir}/qubes-block-cleaner.service %{_unitdir}/qubes-core.service %{_unitdir}/qubes-setupdvm.service %{_unitdir}/qubes-meminfo-writer.service %{_unitdir}/qubes-netvm.service %{_unitdir}/qubes-qmemman.service -%endif %attr(0770,root,qubes) %dir /var/lib/qubes %attr(0770,root,qubes) %dir /var/lib/qubes/vm-templates %attr(0770,root,qubes) %dir /var/lib/qubes/appvms