2016-10-22 17:43:16 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Source Qubes library.
|
2017-09-30 04:56:02 +02:00
|
|
|
# shellcheck source=init/functions
|
2016-10-22 17:43:16 +02:00
|
|
|
. /usr/lib/qubes/init/functions
|
2012-01-10 12:10:16 +01:00
|
|
|
|
2013-06-07 05:20:55 +02:00
|
|
|
# List of services enabled by default (in case of absence of qubesdb entry)
|
2017-11-18 02:44:40 +01:00
|
|
|
DEFAULT_ENABLED_NETVM="network-manager qubes-network qubes-update-check qubes-updates-proxy meminfo-writer qubes-firewall"
|
2017-11-18 02:42:11 +01:00
|
|
|
DEFAULT_ENABLED_PROXYVM="qubes-network qubes-firewall qubes-update-check meminfo-writer"
|
|
|
|
DEFAULT_ENABLED_APPVM="cups qubes-update-check meminfo-writer"
|
2014-09-27 01:52:19 +02:00
|
|
|
DEFAULT_ENABLED_TEMPLATEVM="$DEFAULT_ENABLED_APPVM updates-proxy-setup"
|
2017-11-18 02:42:11 +01:00
|
|
|
DEFAULT_ENABLED="meminfo-writer"
|
2012-01-10 12:10:16 +01:00
|
|
|
|
2016-01-13 05:05:00 +01:00
|
|
|
# Wait for xenbus initialization
|
2020-07-24 16:07:39 +02:00
|
|
|
while [ ! -e /dev/xen/xenbus ]; do
|
2012-01-30 14:22:58 +01:00
|
|
|
sleep 0.1
|
|
|
|
done
|
|
|
|
|
2012-01-10 12:10:16 +01:00
|
|
|
mkdir -p /var/run/qubes
|
2015-02-17 04:51:55 +01:00
|
|
|
chgrp qubes /var/run/qubes
|
|
|
|
chmod 0775 /var/run/qubes
|
2012-01-10 12:10:16 +01:00
|
|
|
mkdir -p /var/run/qubes-service
|
|
|
|
mkdir -p /var/run/xen-hotplug
|
|
|
|
|
|
|
|
# Set default services depending on VM type
|
2016-10-22 17:43:16 +02:00
|
|
|
is_appvm && DEFAULT_ENABLED=$DEFAULT_ENABLED_APPVM && touch /var/run/qubes/this-is-appvm
|
|
|
|
is_netvm && DEFAULT_ENABLED=$DEFAULT_ENABLED_NETVM && touch /var/run/qubes/this-is-netvm
|
|
|
|
is_proxyvm && DEFAULT_ENABLED=$DEFAULT_ENABLED_PROXYVM && touch /var/run/qubes/this-is-proxyvm
|
|
|
|
is_templatevm && DEFAULT_ENABLED=$DEFAULT_ENABLED_TEMPLATEVM && touch /var/run/qubes/this-is-templatevm
|
2012-01-10 12:10:16 +01:00
|
|
|
|
|
|
|
# Enable default services
|
|
|
|
for srv in $DEFAULT_ENABLED; do
|
2017-09-30 04:49:21 +02:00
|
|
|
touch "/var/run/qubes-service/$srv"
|
2012-01-10 12:10:16 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
# Enable services
|
2017-09-30 04:49:21 +02:00
|
|
|
for srv in $(qubesdb-multiread /qubes-service/ 2>/dev/null |grep ' = 1'|cut -f 1 -d ' '); do
|
|
|
|
touch "/var/run/qubes-service/$srv"
|
2012-01-10 12:10:16 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
# Disable services
|
2017-09-30 04:49:21 +02:00
|
|
|
for srv in $(qubesdb-multiread /qubes-service/ 2>/dev/null |grep ' = 0'|cut -f 1 -d ' '); do
|
|
|
|
rm -f "/var/run/qubes-service/$srv"
|
2012-01-10 12:10:16 +01:00
|
|
|
done
|
|
|
|
|
2012-05-22 16:49:03 +02:00
|
|
|
# Prepare environment for other services
|
|
|
|
echo > /var/run/qubes-service-environment
|
|
|
|
|
2012-10-15 02:33:36 +02:00
|
|
|
exit 0
|