70 lines
1.6 KiB
Bash
Executable File
70 lines
1.6 KiB
Bash
Executable File
#!/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
|