packaging rpm, init.d et postinst

This commit is contained in:
Thomas NOËL 2012-07-24 12:41:06 +02:00
parent 877eda27ed
commit 401d2e1898
1 changed files with 23 additions and 1 deletions

View File

@ -64,6 +64,10 @@ BuildArch: noarch
Requires: python26
Requires: python26-virtualenv
Requires: python26-ldap
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
%description
Polynum (polycopiés numériques) est une application web pour demander
@ -80,6 +84,10 @@ afin de mettre à disposition en ligne les polycopiés pour les étudiants.
%{__rm} -rf %{buildroot}
make DESTDIR=%{buildroot} install
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/default
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/init.d
%{__install} -m 644 debian/polynum.default %{buildroot}/%{_sysconfdir}/default/%{name}
%{__install} -m 755 debian/init.d %{buildroot}/%{_sysconfdir}/init.d/%{name}
%clean
@ -88,10 +96,24 @@ make DESTDIR=%{buildroot} install
# the - indicates that the current permissions on the files should be used
%defattr(-,root,root)
%doc help local_settings.py.example gunicorn_config.py.example README
#%config(noreplace) %{_sysconfdir}/%{name}/
%config(noreplace) %{_sysconfdir}/default/%{name}
/opt/polynum/*
/etc/init.d/*
%{_sysconfdir}/%{name}
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add polynum
%preun
# 'if [ $1 -eq 0 ] ' checks that this is the actual deinstallation of the
# package, as opposed to just removing the old package on upgrade. These
# statements stop the service, and remove the /etc/rc*.d links.
if [ $1 -eq 0 ] ; then
/sbin/service polynum stop # >/dev/null 2>&1
/sbin/chkconfig --del polynum
fi
%changelog
* Tue Jul 24 2012 Thomas NOEL <tnoel@entrouvert.com> 0.0-1
- create spec file