Line 0
Link Here
|
|
|
1 |
#!/sbin/runscript |
2 |
# Copyright 1999-2010 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
|
5 |
depend() { |
6 |
need localmount |
7 |
} |
8 |
|
9 |
XE_PROC=/proc/xen |
10 |
XE_LINUX_DISTRIBUTION=/usr/sbin/xe-linux-distribution |
11 |
XE_LINUX_DISTRIBUTION_CACHE=/var/cache/xe-linux-distribution |
12 |
XE_DAEMON=/usr/sbin/xe-daemon |
13 |
XE_DAEMON_PIDFILE=/var/run/xe-daemon.pid |
14 |
|
15 |
checkxen() { |
16 |
if [ ! -d "$XE_PROC" ]; then |
17 |
eerror "Directory not found: $XE_PROC" |
18 |
eerror "You need a post 2.6.29-rc1 kernel with CONFIG_XEN_COMPAT_XENFS=y and CONFIG_XENFS=y|m" |
19 |
return 1 |
20 |
fi |
21 |
} |
22 |
|
23 |
checklinuxdistribution() { |
24 |
if [ ! -x "${XE_LINUX_DISTRIBUTION}" ] ; then |
25 |
eerror "Program not found ${XE_LINUX_DISTRIBUTION}" |
26 |
eerror "You don't appear to have XenTools installed yet." |
27 |
return 1 |
28 |
fi |
29 |
|
30 |
"${XE_LINUX_DISTRIBUTION}" "${XE_LINUX_DISTRIBUTION_CACHE}" \ |
31 |
|| eerror "Linux distribution version not detected." |
32 |
} |
33 |
|
34 |
mountxen() { |
35 |
if [ ! -e "$XE_PROC"/xenbus ] ; then |
36 |
# This is needed post 2.6.29-rc1, /proc/xen support was pushed upstream as a xen filesystem |
37 |
einfo "Mounting xenfs on $XE_PROC" |
38 |
mount -t xenfs none "$XE_PROC" || return 1 |
39 |
fi |
40 |
} |
41 |
|
42 |
start() { |
43 |
checkxen || return 1 |
44 |
|
45 |
checklinuxdistribution || return 1 |
46 |
|
47 |
mountxen || return 1 |
48 |
|
49 |
ebegin "Starting xe daemon" |
50 |
start-stop-daemon --start --exec "${XE_DAEMON}" --background \ |
51 |
--pidfile "${XE_DAEMON_PIDFILE}" --quiet \ |
52 |
-- -p "${XE_DAEMON_PIDFILE}" |
53 |
eend $? |
54 |
} |
55 |
|
56 |
stop() { |
57 |
ebegin "Stopping xe daemon" |
58 |
start-stop-daemon --stop --exec "${XE_DAEMON}" \ |
59 |
--pidfile "${XE_DAEMON_PIDFILE}" --quiet |
60 |
eend $? |
61 |
} |