summaryrefslogtreecommitdiff
path: root/mk/xe-guest-utilities.spec.in
blob: 33392bc142f1682c6a8f1b5d0a2e60ff8ff89a1c (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# -*- rpm-spec -*-

Summary: @BRAND_GUEST@ Monitoring Scripts
Name: xe-guest-utilities
Version: @VERSION@
Release: @RELEASE@
License: BSD
Group: Xen
URL: http://www.citrix.com
Vendor: @COMPANY_NAME_LEGAL@
Source0: xe-linux-distribution
Source1: xe-linux-distribution.init
Source3: xe-daemon
Source5: Citrix.repo
Source6: xenstore
Source8: LICENSE
Source9: xen-vcpu-hotplug.rules
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: golang
Obsoletes: xengmond

%description
Scripts for monitoring @BRAND_GUESTS@.

Writes distribution version information and IP address to XenStore.

%package xenstore
Summary: @BRAND_GUEST@ XenStore utilities
Group: Xen
%description xenstore
Utilities for interacting with XenStore from with a Xen virtual machine

%prep
# Nothing to do
%build
# Nothing to do

%install
rm -rf %{buildroot}

mkdir -p %{buildroot}/usr/sbin/
mkdir -p %{buildroot}/usr/share/doc/%{name}-%{version}/examples/
mkdir -p %{buildroot}/etc/init.d
mkdir -p %{buildroot}/etc/udev/rules.d

cp %{SOURCE0} %{buildroot}/usr/sbin/xe-linux-distribution
chmod 755 %{buildroot}/usr/sbin/xe-linux-distribution

cp %{SOURCE1} %{buildroot}/etc/init.d/xe-linux-distribution
chmod 755 %{buildroot}/etc/init.d/xe-linux-distribution

cp %{SOURCE3} %{buildroot}/usr/sbin/xe-daemon
chmod 755 %{buildroot}/usr/sbin/xe-daemon

cp %{SOURCE5} %{buildroot}/usr/share/doc/%{name}-%{version}/examples/

install -d %{buildroot}/usr/bin/
install -m 755 %{SOURCE6}  %{buildroot}/usr/bin/xenstore
ln -s /usr/bin/xenstore %{buildroot}/usr/bin/xenstore-read
ln -s /usr/bin/xenstore %{buildroot}/usr/bin/xenstore-write
ln -s /usr/bin/xenstore %{buildroot}/usr/bin/xenstore-exists
ln -s /usr/bin/xenstore %{buildroot}/usr/bin/xenstore-rm

cp %{SOURCE9} %{buildroot}/etc/udev/rules.d/z10-xen-vcpu-hotplug.rules

cp %{SOURCE8} %{buildroot}/usr/share/doc/%{name}-%{version}/

mkdir -p %{buildroot}/usr/share/doc/%{name}-xenstore-%{version}
cp %{SOURCE8} %{buildroot}/usr/share/doc/%{name}-xenstore-%{version}/

%clean
rm -rf %{buildroot}

%post
/sbin/chkconfig --add xe-linux-distribution >/dev/null
[ -n "${EXTERNAL_P2V}" ] || service xe-linux-distribution start >/dev/null 2>&1

eval $(/usr/sbin/xe-linux-distribution)

if [ -d /etc/yum.repos.d ] && [ -n "${os_distro}" ] && [ -n "${os_majorver}" ] ; then
    distro="${os_distro}${os_majorver}x"
    case "${distro}" in
    rhel4x|centos4x)
        if [ -f /etc/yum.repos.d/XenSource.repo ] ; then
            rm -f /etc/yum.repos.d/XenSource.repo # contains deprecated urls
        fi
        sed -e "s/\^DISTRO\^/${distro}/g" \
            < /usr/share/doc/%{name}-%{version}/examples/Citrix.repo \
            > /etc/yum.repos.d/Citrix.repo
        ;;
    rhel3x|rhel5x|centos5x|oracle5x) # No vendor kernel any more. Remove Citrix.repo
        if [ -f /etc/yum.repos.d/Citrix.repo ] ; then
            rm -f /etc/yum.repos.d/Citrix.repo
        fi
        ;;
    *) ;;
    esac
fi

%preun
if [ $1 -eq 0 ] ; then
    service xe-linux-distribution stop >/dev/null 2>&1
    /sbin/chkconfig --del xe-linux-distribution >/dev/null
    rm -f /etc/yum.repos.d/Citrix.repo || /bin/true
fi

%files 
%defattr(-,root,root,-)
/usr/sbin/xe-linux-distribution
/etc/init.d/xe-linux-distribution
/usr/sbin/xe-daemon
/etc/udev/rules.d/z10-xen-vcpu-hotplug.rules
/usr/share/doc/%{name}-%{version}/examples/Citrix.repo
/usr/share/doc/%{name}-%{version}/LICENSE

%files xenstore
%defattr(-,root,root,-)
/usr/bin/xenstore-*
/usr/bin/xenstore
/usr/share/doc/%{name}-xenstore-%{version}/LICENSE

%changelog
* Tue Jun 5 2007  <citrix.com>
- Xen monitor scripts