Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 302485 | Differences between
and this patch

Collapse All | Expand All

(-)xe-guest-utilities-5.5.0/gentoo/xe-daemon.init (+61 lines)
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
}
(-)xe-guest-utilities-5.5.0/xe-linux-distribution (+19 lines)
Lines 211-216 Link Here
211
211
212
}
212
}
213
213
214
identify_gentoo()
215
{
216
    gentoo_release="$1"
217
    if [ ! -e "${gentoo_release}" ] ; then
218
	return 1
219
    fi
220
    distro="gentoo"
221
    eval $(cat ${gentoo_release} | awk '{ print "release=" $5 }' )
222
    if [ -z "${release}" ] ; then
223
	return 1
224
    fi
225
    eval $(echo $release | awk -F. -- '{ print "major=" $1 ; print "minor=" $2 }' )
226
    if [ -z "${major}" -o -z "$minor" ] ; then
227
	return 1
228
    fi
229
    write_to_output "${distro}" "${major}" "${minor}" "${distro}"
230
}
231
214
identify_lsb()
232
identify_lsb()
215
{
233
{
216
    lsb_release="$1"
234
    lsb_release="$1"
Lines 257-262 Link Here
257
    identify_sles   /etc/SuSE-release   && exit 0
275
    identify_sles   /etc/SuSE-release   && exit 0
258
    identify_lsb    lsb_release         && exit 0
276
    identify_lsb    lsb_release         && exit 0
259
    identify_debian /etc/debian_version && exit 0
277
    identify_debian /etc/debian_version && exit 0
278
    identify_gentoo /etc/gentoo-release && exit 0
260
279
261
    if [ $# -eq 1 ] ; then
280
    if [ $# -eq 1 ] ; then
262
	rm -f "$1"
281
	rm -f "$1"

Return to bug 302485