From 401d2e1898dbbeec9996992d0084aaaa837fc84a Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Tue, 24 Jul 2012 12:41:06 +0200 Subject: [PATCH] packaging rpm, init.d et postinst --- rpm/centos.spec | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/rpm/centos.spec b/rpm/centos.spec index 644ba20..509ca8a 100644 --- a/rpm/centos.spec +++ b/rpm/centos.spec @@ -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 0.0-1 - create spec file