OSDN Git Service

Merge branch 'dev' of ssh://funagayama@raid.local.hde.co.jp/hde/karesansui/karesansui...
[karesansui/karesansui.git] / doc / redhat.spec
1 %define commerce 0
2 %if %{?commerce:0}%{!?commerce:1}
3 %define commerce 1
4 %endif
5
6 %define __python $(which python)
7 %define __app karesansui
8 %define version 1.0.3
9 %define release 2
10 %define date %(echo `LANG=C date +%%Y%%m%%d%%H%%M%%S`)
11
12 %if %{commerce}
13 %define _vendor_name    hde
14 %define name %{_vendor_name}-karesansui
15 %define __prefix /opt/%{_vendor_name}
16 %define __sysconfdir %{_sysconfdir}/opt/%{_vendor_name}/%{__app}
17 %define python_home  %{__prefix}
18 %else
19 %define _vendor_name    %{nil}
20 %define __prefix /opt
21 %define name karesansui
22 %define __sysconfdir %{_sysconfdir}/opt/%{__app}
23 %define python_home  %{__prefix}/%{__app}
24 %endif
25
26 %define __bindir %{__prefix}/%{__app}/bin
27 %define __tmpdir %{__prefix}/%{__app}/tmp
28 %define _defaultdocdir %{__prefix}/%{__app}/share/doc
29 %define python_sitelib  %{python_home}/lib/python
30
31 %define __pysilhouette_prefix     %{__prefix}/pysilhouette
32 %define __pysilhouette_sysconfdir %{_sysconfdir}/opt/pysilhouette
33
34 %define __vendor_sysconfdir  %{_sysconfdir}/opt/hde
35
36 %define _user           kss
37 %define _group          kss
38 %define _user_doc       Karesansui Project
39 %define _uid_min        250
40 %define _uid_max        300
41
42 Summary: Virtualization management tool(Web Application) 
43 Summary(ja): オープンソースの仮想ホスト管理アプリケーション
44 Name: %{name}
45 Version: %{version}
46 #Release: %{release}.%{date}
47 Release: %{release}
48 Source0: %{__app}-%{version}.tar.gz
49 License: LGPLv2+
50 Group: Applications/System
51 Url: http://karesansui-project.info/
52 Vendor: Karesansui Project
53 Packager: Taizo ITO <taizo@karesansui-project.info>
54 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
55 Prefix: %{_prefix}
56 BuildArch: noarch
57 Provides: %{__app}
58 Requires: hde-libvirt-python
59 Requires: pysilhouette
60 Requires: PyXML
61
62 %description
63 On the Web for virtualization management software to manage.
64     The guest OS and the management of resources and dynamic changes can be done easily.
65     RESTful Web applications in architecture.
66
67 %package data
68 Summary: UI data for Karesansui Core
69 Group: Applications/System
70 License: GPLv2
71 Requires: %{name} = %{version}
72
73 %description data
74 UI data for Karesansui Core
75
76 %package gadget
77 Summary: Basic gadget collection for Karesansui Core
78 Group: Applications/System
79 License: GPLv2
80 Requires: %{name} = %{version}
81
82 %description gadget
83 Basic gadget collection for Karesansui Core
84
85 %package bin
86 Summary: Basic command collection for Karesansui Core
87 Group: Applications/System
88 License: GPLv2
89 Requires: %{name} = %{version}
90
91 %description bin
92 Basic command collection for Karesansui Core
93
94 %package test
95 Summary: Unit test environment for Karesansui Core
96 Group: Applications/System
97 License: LGPLv2+
98 Requires: %{name} = %{version}
99 Requires: hde-python-paste
100
101 %description test
102 Unit test environment for Karesansui Core
103
104 %prep
105 %setup -n %{__app}-%{version}
106
107 %build
108 python setup.py build
109
110 %install
111 python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES --home=%{python_home}
112
113 install -d -m 0770 $RPM_BUILD_ROOT%{__sysconfdir}
114 %{__cp} -f doc/application.conf.example $RPM_BUILD_ROOT%{__sysconfdir}/application.conf.example
115 %{__cp} -f $RPM_BUILD_ROOT%{__sysconfdir}/application.conf{.example,}
116 %{__cp} -f doc/log.conf.example $RPM_BUILD_ROOT%{__sysconfdir}/log.conf.example
117 %{__cp} -f $RPM_BUILD_ROOT%{__sysconfdir}/log.conf{.example,}
118 %{__cp} -fr doc/lighttpd/ $RPM_BUILD_ROOT%{__sysconfdir}/lighttpd.example/
119 %{__cp} -f doc/whitelist.conf.example $RPM_BUILD_ROOT%{__sysconfdir}/
120
121 install -d -m 0770 $RPM_BUILD_ROOT/{etc,var}/opt/karesansui
122 install -d -m 0770 $RPM_BUILD_ROOT/var/log/karesansui
123 install -d -m 0770 $RPM_BUILD_ROOT%{__tmpdir}
124
125 find $RPM_BUILD_ROOT%{python_sitelib}/karesansui -type d -exec chmod g+rwx \{\} \; 2>/dev/null
126
127 %clean
128 rm -rf $RPM_BUILD_ROOT
129
130 %pre
131 # Add group
132 getent group | %{__grep} "^%{_group}:" >/dev/null 2>&1
133 if [ $? -ne 0 ]; then
134   __uid=%{_uid_min}
135   while test ${__uid} -le %{_uid_max}
136   do
137     getent group | %{__grep} "^[^:]*:x:${__uid}:" >/dev/null 2>&1
138     if [ $? -ne 0 ]; then
139       _gid=${__uid}
140       break
141     fi
142     __uid=`expr ${__uid} + 1`
143   done
144   /usr/sbin/groupadd -g ${_gid} -f %{_group}
145 fi
146
147 # Add user
148 getent passwd | %{__grep} "^%{_user}:" >/dev/null 2>&1
149 if [ $? -ne 0 ]; then
150   __uid=%{_uid_min}
151   while test ${__uid} -le %{_uid_max}
152   do
153     getent passwd | %{__grep} "^[^:]*:x:${__uid}:" >/dev/null 2>&1
154     if [ $? -ne 0 ]; then
155       _uid=${__uid}
156       break
157     fi
158     __uid=`expr ${__uid} + 1`
159   done
160   /usr/sbin/useradd -c "%{_user_doc}" -u ${_uid} -g %{_group} -s /bin/false -r %{_user} 2> /dev/null || :
161 fi
162
163 # Add wwwhde user to %{_group} group member
164 %{__grep} ^wwwhde: /etc/passwd >/dev/null 2>&1
165 if [ $? -eq 0 ]; then
166   gpasswd -a wwwhde %{_group} >/dev/null 2>&1
167   gpasswd -a %{_group} wwwhde >/dev/null 2>&1
168 fi
169
170 %post
171 # Modify libvirt configuration file.
172 sysconfig_libvirt=%{_sysconfdir}/sysconfig/hde-libvirtd
173 if [ -f ${sysconfig_libvirt} ]; then
174   %{__grep} "^PRIVSEP_GROUP=" ${sysconfig_libvirt} >/dev/null 2>&1
175   if [ $? -ne 0 ]; then
176     echo "PRIVSEP_GROUP=%{_group}" >>${sysconfig_libvirt}
177   fi
178 fi
179 libvirtd_conf=%{__vendor_sysconfdir}/libvirt/libvirtd.conf
180 if [ -f ${libvirtd_conf} ]; then
181   %{__grep} '^unix_sock_group = "root"' ${libvirtd_conf} >/dev/null 2>&1
182   if [ $? -eq 0 ]; then
183     %{__sed} -e "s#unix_sock_group = \"root\"#unix_sock_group = \"%{_group}\"#"       ${libvirtd_conf} >${libvirtd_conf}.$$
184     %{__cp} -f ${libvirtd_conf}.$$ ${libvirtd_conf}
185     %{__rm} -f ${libvirtd_conf}.$$
186   fi
187 fi
188
189 # Make directory
190 if [ -d %{__vendor_sysconfdir} ]; then
191   %{__mkdir_p} %{__vendor_sysconfdir}/xen/xml/
192   %{__chgrp} -R %{_group} %{__vendor_sysconfdir}/xen/ >/dev/null 2>&1
193   %{__chmod} -R g+rw %{__vendor_sysconfdir}/xen/ >/dev/null 2>&1
194 fi
195 libvirt_datadir=/var/opt/hde/libvirt
196 if [ -d ${libvirt_datadir} ]; then
197   #for subdir in boot images snapshot disk
198   for subdir in domains
199   do
200     %{__mkdir_p} ${libvirt_datadir}/${subdir}
201     %{__chmod} g+rwx ${libvirt_datadir}/${subdir} >/dev/null 2>&1
202     %{__chmod} o-rwx ${libvirt_datadir}/${subdir} >/dev/null 2>&1
203   done
204   %{__chgrp} -R %{_group} ${libvirt_datadir}/ >/dev/null 2>&1
205   %{__chmod} g+rwx ${libvirt_datadir}/ >/dev/null 2>&1
206 fi
207
208 # Modify lighttpd configuration file.
209 for lighttpd_sysconfdir in %{__vendor_sysconfdir}/lighttpd /etc/lighttpd
210 do
211   if [ -d ${lighttpd_sysconfdir} ]; then
212     %{__mkdir_p} ${lighttpd_sysconfdir}/conf.d/karesansui/ >/dev/null 2>&1
213     if [ ! -f ${lighttpd_sysconfdir}/conf.d/karesansui.conf ]; then
214       %{__cp} -f %{__sysconfdir}/lighttpd.example/karesansui.conf ${lighttpd_sysconfdir}/conf.d/
215       %{__cp} -f %{__sysconfdir}/lighttpd.example/{access,port,ssl}.conf ${lighttpd_sysconfdir}/conf.d/karesansui/
216       %{__chgrp} -R %{_group} ${lighttpd_sysconfdir}/conf.d/karesansui*
217       %{__chmod} -R 0660 ${lighttpd_sysconfdir}/conf.d/karesansui/*
218     fi
219   fi
220 done
221
222 # Register whitelist commands to pysilhouette service.
223 if [ -d %{__pysilhouette_sysconfdir} ]; then
224   if [ ! -s %{__pysilhouette_sysconfdir}/whitelist.conf ]; then
225     %{__cp} -f %{__sysconfdir}/whitelist.conf.example %{__pysilhouette_sysconfdir}/whitelist.conf
226   fi
227 fi
228
229 %postun
230 if [ $1 = 0 ]; then
231   /usr/sbin/userdel %{_user} 2> /dev/null || :
232   /usr/sbin/groupdel %{_group} 2> /dev/null || :
233
234   # Modify libvirt configuration file.
235   sysconfig_libvirt=%{_sysconfdir}/sysconfig/hde-libvirtd
236   if [ -f ${sysconfig_libvirt} ]; then
237     %{__grep} -v "^PRIVSEP_GROUP=" ${sysconfig_libvirt} >${sysconfig_libvirt}.$$
238     %{__cp} -f ${sysconfig_libvirt}.$$ ${sysconfig_libvirt}
239     %{__rm} -f ${sysconfig_libvirt}.$$
240   fi
241   libvirtd_conf=%{__vendor_sysconfdir}/libvirt/libvirtd.conf
242   if [ -f ${libvirtd_conf} ]; then
243     %{__grep} '^unix_sock_group =' ${libvirtd_conf} >/dev/null 2>&1
244     if [ $? -eq 0 ]; then
245       %{__sed} -e "s#unix_sock_group = .*#unix_sock_group = \"root\"#"  ${libvirtd_conf} >${libvirtd_conf}.$$
246       %{__cp} -f ${libvirtd_conf}.$$ ${libvirtd_conf}
247       %{__rm} -f ${libvirtd_conf}.$$
248     fi
249   fi
250 fi
251
252 #%files -f INSTALLED_FILES
253 #%defattr(-,root,root)
254 #%doc doc tool
255
256 %files
257 %defattr(-,root,%{_group})
258 %doc doc tool AUTHORS COPYING COPYING.LIB INSTALL INSTALL.ja README README.ja
259 %dir %{python_sitelib}/
260 %dir %{python_sitelib}/karesansui/
261 %dir %{python_sitelib}/karesansui/db/
262 %dir %{python_sitelib}/karesansui/lib/
263 %dir %{python_sitelib}/karesansui/static/
264 %{python_sitelib}/karesansui/*.py*
265 %{python_sitelib}/karesansui/db/*.py*
266 %{python_sitelib}/karesansui/db/access/*.py*
267 %{python_sitelib}/karesansui/db/model/*.py*
268 %{python_sitelib}/karesansui/lib/*
269 %{python_sitelib}/karesansui/static/js/*
270 %{python_sitelib}/karesansui/static/lib/*
271 %{__sysconfdir}/*.example
272 %defattr(0770,root,%{_group})
273 %config(noreplace) %{__sysconfdir}/*.conf
274 %dir %{__sysconfdir}/
275 %dir /var/opt/karesansui/
276 %dir /var/log/karesansui/
277 %dir %{__tmpdir}/
278
279 %files data
280 %defattr(-,root,%{_group})
281 %dir %{python_sitelib}/karesansui/static/css/
282 %dir %{python_sitelib}/karesansui/static/icon/
283 %dir %{python_sitelib}/karesansui/static/images/
284 %dir %{python_sitelib}/karesansui/locale/
285 %{python_sitelib}/karesansui/static/css/*
286 %{python_sitelib}/karesansui/static/icon/*
287 %{python_sitelib}/karesansui/static/images/*
288 %{python_sitelib}/karesansui/locale/*/LC_MESSAGES/*.mo
289
290 %files gadget
291 %defattr(-,root,%{_group})
292 %dir %{python_sitelib}/karesansui/gadget/
293 %dir %{python_sitelib}/karesansui/templates/default/
294 %{python_sitelib}/karesansui/gadget/*
295 %{python_sitelib}/karesansui/templates/default/*
296
297 %files bin
298 %defattr(0770,root,%{_group})
299 %dir %{__bindir}/
300 %defattr(0550,root,%{_group})
301 %{__bindir}/*
302
303 %files test
304 %defattr(-,root,%{_group})
305 %dir %{python_sitelib}/karesansui/tests/
306 %{python_sitelib}/karesansui/tests/*
307
308 %changelog
309 * Thu Oct 29 2009 Kei Funagayama <kei@karesansui-project.info> - 1.0.3-2
310 - CentOS(i386/x86_64) support.
311 - RHEL(i386/x86_64) support.
312 * Tue Sep 18 2009 Kei Funagayama <kei@karesansui-project.info> - 1.0.3-1
313 - Added checker for keymap selection.
314 - Fixed web server setting bugs.
315 - Fixed the following hungup bug.
316     ** glibc detected *** /usr/bin/python: free(): invalid pointer:
317 - Changed the format of system uri path.
318     fixed error "unexpected Xen URI path '/system', try xen:///" for libvirt-0.6.5.
319 * Thu Jun 18 2009 Kei Funagayama <kei@karesansui-project.info> - 1.0.2-1
320 - Sparce file support is now available at creating a guest environment.
321 - Keyboard maps selection is now available at creating a guest environment.
322 - Fixed rpm transaction closing order.
323 - Fixed checking of processor support.
324 - sqlite time to register with the system, had not added the time zone information.
325 - Network database is now available as pysilhouette database.
326 - Addresses an issue which karesansui does not work at multi-host environment.
327 * Tue Jun 9 2009 Kei Funagayama <kei@karesansui-project.info> - 1.0.1-1
328 - Karesansui now works on CentOS5.3 64bit(x86_64), RHEL5.3 64bit(x86_64) and RHEL5.3 32bit(x86).
329 - Added support for AMD Athlon64 or Opteron environment.
330 - Added favicons.
331 - Improves VNC console keyboard layout support.
332 - Prevents host environment's FQDN from being resolved.
333 - Highlights required items on input forms.
334 - Buttons turn disabled not to be clicked after clicking at dialog window.
335 - Karesansui now works when PostgreSQL is selected as database at the installation process.
336 - Addresses an issue which could not reach the management console after resetting F/W.
337 - Addresses an issue which could not move to other tabs while displaying guest console.
338 - Delete button is now turned disabled after destroying resources.
339 - Network configuration is now editable without errors.
340 - Addresses an issue which occurs when job search is performanced many times.
341 - Creating guest with empty value in "Memory Size" or "Disk Size" now works.
342 - Prevent input data from being posted to other resources when enter key is pressed on input forms.
343 - Improved a check logic about guest ID.
344 - Improved error handling on nonexistent NIC.
345 * Tue May 19 2009 Taizo ITO <taizo@karesansui-project.info> - 1.0.0-1
346 - Initial build.