%define version ${:version} %define name ${:name} %define release ${:release} %define erp5user erp5 %define fullname %{name}-%{version} %define installdir /var/lib/erp5 %define __find_provides ${:find_provides} %define softwarehome ${:softwarehome} %define softwarename ${:softwarename} Name: %{name} Version: %{version} Release: %mkrel %{release} Summary: Open Source ERP Solution URL: http://www.erp5.org License: GPL Vendor: Nexedi Packager: Lukasz Nowak Group: Databases Requires: erp5 = ${:version} Requires: logrotate ${:dependencies} BuildRequires: %{softwarename} BuildRoot: /opt/rpmbuild/%{fullname}-%{release}-root %description %{summary} %pre %_pre_useradd %{erp5user} %{installdir} /bin/false %build mkdir -p %{installdir} cd %{installdir} svn co https://svn.erp5.org/repos/public/erp5/release/5.4.6/ . echo "[software_definition]" >> timmy-base.cfg echo "software_home = %{softwarehome}" >> timmy-base.cfg %{softwarehome}/bin/python2.4 -S bootstrap/bootstrap.py -c timmy-base.cfg bin/buildout -c timmy-base.cfg %post echo $'%{installdir}/var/log/timmy.log {\nsharedscripts\nrotate 10\nweekly\nmissingok\ncompress\n}' > /etc/logrotate.d/timmy echo '*/5 * * * * bin/timmy -k server.key -s https://www.tiolive.com/slap_service/ -b timmy-base.cfg -o timmy-controller.cfg -d timmy-instances -r bin/buildout -p timmy.pid -l var/log/timmy.log' > erp5.crontab crontab -u erp5 erp5.crontab rm -f erp5.crontab cd %{installdir} bin/timmy-keygen -k server.key echo "Navigate to http://appliance.tiolive.com/ and use the server key to register new computer" chown erp5 server.key %postun # XXX: Check that user directory is *NOT* deleted %_postun_userdel %{erp5user} %install %{__rm} -rf %{buildroot} %{__mkdir_p} %{buildroot} %{__cp} -ar --parents %{installdir} %{buildroot} %files %defattr(-, erp5, erp5, 0755) %{installdir} %clean %{__rm} -rf %{buildroot} %{installdir}