OSDN Git Service

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