summaryrefslogtreecommitdiff
blob: 05bcbb2725c2019161d0c851fba9d4dd2e2723c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
	need xencommons
}

xenstored_dir_check() {
	# create dir dynamically
	local i
	for i in /var/lock/subsys /run/xen /run/xend/boot /run/xenstored; do
		[ -x $i ] || mkdir -p $i
	done
}

start() {
	ebegin "Starting xenstored daemon"
	xenstored_dir_check
	start-stop-daemon --start --exec /usr/sbin/xenstored \
		--pidfile /run/xenstored.pid \
		-- --pid-file=/run/xenstored.pid \
		$XENSTORED_OPTS
	until xenstore-exists / || $((15 < ++i))
	do
		echo -n .
		sleep 1
	done
	einfo "Setting domain0 name record"
	/usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"
	local V=$(xl info| awk "/xen_minor/ { print \$3 }")
	[ $V -ge 4 ] && /usr/bin/xenstore-write "/local/domain/0/domid" 0

	eend $*
}

stop() {
	ebegin "Stopping xenstored daemon"
	start-stop-daemon --stop --exec /usr/sbin/xenstored \
		--pidfile /run/xenstored.pid
	eend $?
}