2010-04-05 20:58:57 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2011-04-05 14:31:19 +02:00
|
|
|
# chkconfig: 2345 80 00
|
2010-04-05 20:58:57 +02: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:"
|
2012-02-25 13:54:39 +01:00
|
|
|
modprobe evtchn 2> /dev/null || modprobe xen-evtchn
|
2012-07-18 12:46:36 +02:00
|
|
|
/usr/lib/qubes/fix_dir_perms.sh
|
2011-06-10 12:02:32 +02:00
|
|
|
|
2011-09-29 13:51:09 +02:00
|
|
|
xenstore-write /local/domain/0/name dom0
|
2011-09-08 01:19:59 +02:00
|
|
|
DOM0_MAXMEM=`/usr/sbin/xl info | grep total_memory | awk '{ print $3 }'`
|
|
|
|
xenstore-write /local/domain/0/memory/static-max $[ $DOM0_MAXMEM * 1024 ]
|
2011-06-01 23:44:06 +02:00
|
|
|
|
|
|
|
xl sched-credit -d 0 -w 512
|
2010-04-05 20:58:57 +02:00
|
|
|
cp /var/lib/qubes/qubes.xml /var/lib/qubes/backup/qubes-$(date +%F-%T).xml
|
2010-09-09 17:51:53 +02:00
|
|
|
|
2012-07-20 16:32:17 +02:00
|
|
|
/usr/lib/qubes/qmemman_daemon.py
|
2010-09-09 17:51:53 +02:00
|
|
|
MEM_CHANGE_THRESHOLD_KB=30000
|
|
|
|
MEMINFO_DELAY_USEC=100000
|
2012-07-20 16:41:26 +02:00
|
|
|
/usr/lib/qubes/meminfo-writer $MEM_CHANGE_THRESHOLD_KB $MEMINFO_DELAY_USEC
|
2010-09-09 17:51:53 +02:00
|
|
|
|
2012-06-13 04:08:09 +02:00
|
|
|
# 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`; do
|
|
|
|
( eval `udevadm info -q property -n $dev|sed -e 's/\([^=]*\)=\(.*\)/export \1="\2"/'`;
|
2012-06-22 01:22:06 +02:00
|
|
|
/usr/lib/qubes/block_add_change > /dev/null
|
2012-06-13 04:08:09 +02:00
|
|
|
)
|
|
|
|
done
|
2012-05-30 00:54:24 +02:00
|
|
|
|
2010-04-05 20:58:57 +02:00
|
|
|
touch /var/lock/subsys/qubes_core
|
|
|
|
success
|
|
|
|
echo
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
|
|
|
echo -n $"Shutting down all Qubes VMs:"
|
2012-01-16 03:26:39 +01:00
|
|
|
qvm-shutdown -q --all --wait
|
2010-04-05 20:58:57 +02:00
|
|
|
rm -f /var/lock/subsys/qubes_core
|
2010-10-04 15:20:09 +02:00
|
|
|
killall meminfo-writer
|
|
|
|
killall qmemman_daemon.py
|
2010-04-05 20:58:57 +02:00
|
|
|
success
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop}"
|
|
|
|
exit 3
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|