-
Notifications
You must be signed in to change notification settings - Fork 283
/
init.d-sdkinit
executable file
·52 lines (47 loc) · 1.18 KB
/
init.d-sdkinit
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
45
46
47
48
49
50
51
52
#!/bin/sh
#
# /etc/init.d/init.d-sdkinit
# Creates some fake information for the SDK fake xapi
#
# chkconfig: 345 21 00
# description: Populate xensource-inventory
. /etc/init.d/functions
case "$1" in
start)
# This is a run-once script!
if [ -e @INVENTORY@ ]; then
exit 0
fi
echo -n "Starting sdkinit: "
cat /proc/cpuinfo > @ETCDIR@/boot_time_cpu
touch @ETCDIR@/boot_time_info_updated
if [ -d /proc/xen ]; then
# Set the domain0 uuid to the real uuid of this SDK VM
DOMID=`/usr/bin/xenstore-read domid`
VMUUID=`/usr/bin/xenstore-read /local/domain/$DOMID/vm | cut -c5-`
DOM0UUID=$VMUUID
else
# If booting HVM we have no uuid knowledge
DOM0UUID=`uuidgen`
fi
HOSTUUID=`uuidgen`
INSTALLDATE=`date "+%Y-%m-%d %H:%M:%S.000000"`
(cat @INVENTORY@.skel; cat << EOF) > @INVENTORY@
KERNEL_VERSION='2.6.18-92.1.6.el5.xs4.1.920.367.638xen'
XEN_VERSION='3.2.1'
INSTALLATION_DATE='${INSTALLDATE}'
PRIMARY_DISK='/dev/sda'
BACKUP_PARTITION='/dev/sda2'
INSTALLATION_UUID='${HOSTUUID}'
CONTROL_DOMAIN_UUID='${DOM0UUID}'
DEFAULT_SR_PHYSDEVS='/dev/sda3'
DOM0_MEM='752'
EOF
echo "[ OK ]"
;;
stop)
;;
*)
echo "Usage: $0 [start|stop]"
;;
esac