updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / xe-guest-utilities / xe-guest-utilities-archlinux.patch
blob60862410349326373aa4202d3ec4cefbdb74212b
1 diff -uNr src.orig//etc/init.d/xe-linux-distribution src/etc/init.d/xe-linux-distribution
2 --- src.orig//etc/init.d/xe-linux-distribution 2010-05-20 13:19:02.000000000 +0200
3 +++ src/etc/init.d/xe-linux-distribution 2010-10-04 14:45:11.000000000 +0200
4 @@ -18,24 +18,8 @@
5 LANG="C"
6 export LANG
8 -if [ -f /etc/init.d/functions ] ; then
9 -. /etc/init.d/functions
10 -else
11 -action()
13 - descr=$1 ; shift
14 - cmd=$@
15 - echo -n "$descr "
16 - $cmd
17 - ret=$?
18 - if [ $ret -eq 0 ] ; then
19 - echo "OK"
20 - else
21 - echo "Failed"
22 - fi
23 - return $ret
25 -fi
26 +. /etc/rc.conf
27 +. /etc/rc.d/functions
29 XE_LINUX_DISTRIBUTION=/usr/sbin/xe-linux-distribution
30 XE_LINUX_DISTRIBUTION_CACHE=/var/cache/xe-linux-distribution
31 @@ -48,35 +32,59 @@
33 start()
35 + if [ -e /proc/xen/capabilities ] && grep -q control_d /proc/xen/capabilities ; then
36 + # Do not want daemon in domain 0
37 + exit 0
38 + fi
40 + stat_busy "Detecting Linux distribution version"
41 + ${XE_LINUX_DISTRIBUTION} ${XE_LINUX_DISTRIBUTION_CACHE}
42 + if [ $? -gt 0 ]; then
43 + stat_fail
44 + else
45 + stat_done
46 + fi
48 if [ ! -e /proc/xen/xenbus ] ; then
49 if [ ! -d /proc/xen ] ; then
50 - action $"Mounting xenfs on /proc/xen:" /bin/false
51 + stat_busy "Mounting xenfs on /proc/xen"
52 echo "Could not find /proc/xen directory."
53 echo "You need a post 2.6.29-rc1 kernel with CONFIG_XEN_COMPAT_XENFS=y and CONFIG_XENFS=y|m"
54 - exit 1
55 + stat_die 1
56 else
57 # This is needed post 2.6.29-rc1 when /proc/xen support was pushed upstream as a xen filesystem
58 - action $"Mounting xenfs on /proc/xen:" mount -t xenfs none /proc/xen
59 + stat_busy "Mounting xenfs on /proc/xen"
60 + mount -t xenfs none /proc/xen
61 + if [ $? -gt 0 ]; then
62 + stat_fail
63 + else
64 + stat_done
65 + fi
69 - if [ -e /proc/xen/capabilities ] && grep -q control_d /proc/xen/capabilities ; then
70 - # Do not want daemon in domain 0
71 - exit 0
72 - fi
74 - action $"Detecting Linux distribution version:" \
75 - ${XE_LINUX_DISTRIBUTION} ${XE_LINUX_DISTRIBUTION_CACHE}
77 - action $"Starting xe daemon: " /bin/true
78 + stat_busy "Starting xe daemon"
79 mkdir -p $(dirname ${XE_DAEMON_PIDFILE})
80 # This is equivalent to daemon() in C
81 ( exec &>/dev/null ; ${XE_DAEMON} -p ${XE_DAEMON_PIDFILE} & )
82 + if [ $? -gt 0 ]; then
83 + stat_fail
84 + else
85 + add_daemon xe-linux-distribution
86 + stat_done
87 + fi
90 stop()
92 - action $"Stopping xe daemon: " kill -TERM $(cat ${XE_DAEMON_PIDFILE})
93 + stat_busy "Stopping xe daemon"
94 + killall $(basename ${XE_DAEMON}) -TERM
95 + if [ $? -gt 0 ]; then
96 + stat_fail
97 + else
98 + rm_daemon xe-linux-distribution
99 + stat_done
100 + fi
103 # fail silently if not running xen
104 @@ -91,7 +99,7 @@
105 stop)
106 stop
108 - force-reload|restart)
109 + restart)
110 stop
111 start
113 diff -uNr src.orig//usr/sbin/xe-linux-distribution src/usr/sbin/xe-linux-distribution
114 --- src.orig//usr/sbin/xe-linux-distribution 2010-05-20 13:19:02.000000000 +0200
115 +++ src/usr/sbin/xe-linux-distribution 2010-10-04 14:44:37.000000000 +0200
116 @@ -51,6 +51,22 @@
117 return 0
120 +identify_archlinux()
122 + local archlinux_version="$1"
123 + local major
124 + local minor
126 + if [ ! -f "${archlinux_version}" ] ; then
127 + return 1
128 + fi
130 + eval $(LC_ALL=C pacman -Qi initscripts |grep Version |sed "s/^.*: //" | \
131 + awk -F. '{print "major="$1 ; print "minor="$2 ; exit 0 }' )
132 + write_to_output "archlinux" "${major}" "${minor}" "Arch Linux ${major}.${minor}"
136 identify_debian()
138 local debian_version="$1"
139 @@ -258,6 +274,7 @@
140 identify_sles /etc/SuSE-release && exit 0
141 identify_lsb lsb_release && exit 0
142 identify_debian /etc/debian_version && exit 0
143 + identify_archlinux /etc/arch-release && exit 0
145 if [ $# -eq 1 ] ; then
146 rm -f "$1"