#conditional stuff for selinux %bcond_without selinux Name: sahana Version: 0.6.2.2 Release: 3%{?dist} Summary: Sahana is a free open source disaster management application Group: Applications/Publishing License: LGPLv2+ URL: http://www.sahana.lk/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz #URL for source is http://code.zikula.org/core/downloads/99 Source1: sahana.conf BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: dos2unix Requires: httpd Requires: php >= 5.2.0 Requires: php-mysql >= 5.2.0 Requires: php-gd Requires(pre): policycoreutils %description Sahana is a free and open source Disaster Management System.It mainly facilitates management of Missing people, disaster victims, Managing and administrating various organisations, managing camps and managing requests and assistance in the proper distribution of resources. %pre %if %{with selinux} semanage fcontext -a -t httpd_var_run_t %{_sysconfdir}/%{name} 2>/dev/null || semanage fcontext -m -t httpd_var_run_t %{_sysconfdir}/%{name} 2>/dev/null || : semanage fcontext -a -t httpd_var_run_t %{_sysconfdir}/%{name}/conf-order.inc 2>/dev/null || semanage fcontext -m -t httpd_var_run_t %{_sysconfdir}/%{name}/conf-order.inc 2>/dev/null || : semanage fcontext -a -t httpd_var_run_t %{_sysconfdir}/%{name}/sysconf.inc.tpl 2>/dev/null || semanage fcontext -m -t httpd_var_run_t %{_sysconfdir}/%{name}/sysconf.inc.tpl 2>/dev/null || : semanage fcontext -a -t httpd_var_run_t %{_sysconfdir}/%{name}/sysconf.inc 2>/dev/null || semanage fcontext -m -t httpd_var_run_t %{_sysconfdir}/%{name}/sysconf.inc 2>/dev/null || : %endif %prep %setup -qn %{name} %build #nothing really for this section but rpmbuild complains if build is empty %install rm -rf %{buildroot} %{__mkdir} -p %{buildroot}/%{_datadir}/%{name} %{__mkdir} -m 0775 -p %{buildroot}/%{_sysconfdir}/%{name} %{__mkdir} -p %{buildroot}/%{_sysconfdir}/httpd/conf.d/ %{__mkdir} -p %{buildroot}/%{_localstatedir}/lib/%{name} rm -rf www/tmp # in the above we are deleting the tmp dir and we'll link tmp to localstatedir cp -pr 3rd inc inst mod res test tools www -t %{buildroot}/%{_datadir}/%{name} install -m 0644 about.inc %{buildroot}/%{_datadir}/%{name} chmod -x CHANGELOG.TXT dos2unix README_Portable_App install -m 0664 ./conf/* %{buildroot}/%{_sysconfdir}/%{name}/ ln -sf ../../..%{_sysconfdir}/%{name}/ %{buildroot}/%{_datadir}/%{name}/conf install -m 0644 -D -p %{SOURCE1} %{buildroot}/%{_sysconfdir}/httpd/conf.d/sahana.conf ln -sf ../../../../..%{_localstatedir}/lib/%{name} %{buildroot}/%{_datadir}/%{name}/www/tmp find ${RPM_BUILD_ROOT} -type f -name \*.php -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.js -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.css -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.html -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.ini -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.xsl -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.xml -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.svg -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.txt -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.ent -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -name \*.dtd -exec dos2unix {} \; find ${RPM_BUILD_ROOT} -type f -executable -exec chmod 644 {} \; find ${RPM_BUILD_ROOT} -empty -exec rm -f {} \; find ${RPM_BUILD_ROOT} -name .htaccess -exec rm -f {} \; find ${RPM_BUILD_ROOT} -type f -name \*.pl -exec chmod 755 {} \; find ${RPM_BUILD_ROOT} -type f -name check_template -exec chmod 755 {} \; chmod +x %{buildroot}/%{_datadir}/%{name}/test/code/* grep -IUrl '^M' ${RPM_BUILD_ROOT} | xargs -ifile dos2unix 'file' chmod +x %{buildroot}/%{_datadir}/%{name}/3rd/htmlpurifier/maintenance/*-*.php chmod +x %{buildroot}/%{_datadir}/%{name}/tools/build_pot chmod +x %{buildroot}/%{_datadir}/%{name}/inst/create-mysql chmod +x %{buildroot}/%{_datadir}/%{name}/inc/lib_asp/handler_options.inc chmod +x %{buildroot}/%{_datadir}/%{name}/inc/lib_asp/lib_message.inc %clean rm -rf %{buildroot} %post symlinks -crs /usr/share/sahana >/dev/null 2>&1 || : %files %defattr(-,root,root,-) %doc INSTALL %doc README %doc README_Portable_App %doc CHANGELOG.TXT %{_datadir}/%{name} %attr(-,apache,apache) %{_localstatedir}/lib/%{name} %config(noreplace) %{_sysconfdir}/httpd/conf.d/sahana.conf %attr(775,root,apache) %dir %{_sysconfdir}/%{name} %attr(664,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/sysconf.inc.tpl %attr(664,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/conf-order.inc %changelog * Tue Mar 31 2009 David Nalley 0.6.2.2-3 - added BuildRequires dos2unix * Sun Mar 29 2009 David Nalley 0.6.2.2-2 - corrected semanage pre scripts to be conditional - pushed all output from symlinks to /dev/null since there is no silent option - moved post between clean and files - changed attr to 775 for conf dir and 664 for files so that the webinstall will work. - created symlink www/tmp to localstatedir to facilitate writing by apache - changed url to source to use macros for name and version * Fri Mar 20 2009 David Nalley 0.6.2.2-1 - Initial packaging