blob: 6ce0be8ce132f8dcdef6c8ac9c6d56d7cbd59242 (
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
## template: cheetah
# See: http://www.zarb.org/~jasonc/macros.php
# Or: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets
# Or: http://www.rpm.org/max-rpm/ch-rpm-inside.html
Name: cloud-init
Version: ${version}
Release: 1${subrelease}%{?dist}
Summary: Cloud instance init scripts
Group: System/Management
License: Dual licensed GPLv3 or Apache 2.0
URL: http://launchpad.net/cloud-init
Source0: ${archive_name}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
BuildRequires: fdupes
BuildRequires: filesystem
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python-cheetah
%if 0%{?suse_version} && 0%{?suse_version} <= 1210
%define initsys sysvinit
%else
%define initsys systemd
%endif
# System util packages needed
Requires: iproute2
Requires: e2fsprogs
Requires: net-tools
Requires: procps
Requires: sudo
# Install pypi 'dynamic' requirements
#for $r in $requires
Requires: ${r}
#end for
# Custom patches
#set $size = 0
#for $p in $patches
Patch${size}: $p
#set $size += 1
#end for
%description
Cloud-init is a set of init scripts for cloud instances. Cloud instances
need special scripts to run during initialization to retrieve and install
ssh keys and to let the user run various scripts.
%prep
%setup -q -n ${source_name}
# Custom patches activation
#set $size = 0
#for $p in $patches
%patch${size} -p1
#set $size += 1
#end for
%build
%{__python} setup.py build
%install
%{__python} setup.py install \
--skip-build --root=%{buildroot} --prefix=%{_prefix} \
--record-rpm=INSTALLED_FILES --install-lib=%{python_sitelib} \
--init-system=%{initsys}
# Remove non-SUSE templates
rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.debian.*
rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.redhat.*
rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.ubuntu.*
# Remove cloud-init tests
rm -r %{buildroot}/%{python_sitelib}/tests
# Move sysvinit scripts to the correct place and create symbolic links
%if %{initsys} == sysvinit
mkdir -p %{buildroot}/%{_initddir}
mv %{buildroot}%{_sysconfdir}/rc.d/init.d/* %{buildroot}%{_initddir}/
rmdir %{buildroot}%{_sysconfdir}/rc.d/init.d
rmdir %{buildroot}%{_sysconfdir}/rc.d
mkdir -p %{buildroot}/%{_sbindir}
pushd %{buildroot}/%{_initddir}
for file in * ; do
ln -s %{_initddir}/\${file} %{buildroot}/%{_sbindir}/rc\${file}
done
popd
%endif
# Move documentation
mkdir -p %{buildroot}/%{_defaultdocdir}
mv %{buildroot}/usr/share/doc/cloud-init %{buildroot}/%{_defaultdocdir}
for doc in TODO LICENSE ChangeLog requirements.txt; do
cp \${doc} %{buildroot}/%{_defaultdocdir}/cloud-init
done
# Remove duplicate files
%if 0%{?suse_version}
%fdupes %{buildroot}/%{python_sitelib}
%endif
mkdir -p %{buildroot}/var/lib/cloud
%postun
%insserv_cleanup
%files
# Sysvinit scripts
%if %{initsys} == sysvinit
%attr(0755, root, root) %{_initddir}/cloud-config
%attr(0755, root, root) %{_initddir}/cloud-final
%attr(0755, root, root) %{_initddir}/cloud-init-local
%attr(0755, root, root) %{_initddir}/cloud-init
%{_sbindir}/rccloud-*
%endif
# Program binaries
%{_bindir}/cloud-init*
# There doesn't seem to be an agreed upon place for these
# although it appears the standard says /usr/lib but rpmbuild
# will try /usr/lib64 ??
/usr/lib/%{name}/uncloud-init
/usr/lib/%{name}/write-ssh-key-fingerprints
# Docs
%doc %{_defaultdocdir}/cloud-init/*
# Configs
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
%dir %{_sysconfdir}/cloud/cloud.cfg.d
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/README
%dir %{_sysconfdir}/cloud/templates
%config(noreplace) %{_sysconfdir}/cloud/templates/*
# Python code is here...
%{python_sitelib}/*
/var/lib/cloud
|