Update sogo.spec

pull/76/head
peruchi 2015-03-31 14:36:04 -03:00
parent 36a70b161c
commit c9ec636a53
1 changed files with 40 additions and 7 deletions

View File

@ -14,6 +14,13 @@
%{!?python_sys_pyver: %global python_sys_pyver %(/usr/bin/python -c "import sys; print sys.hexversion")}
# Systemd for fedora >= 17 or el 7
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
%global _with_systemd 1
%else
%global _with_systemd 0
%endif
%define sogo_user sogo
Summary: SOGo
@ -217,7 +224,13 @@ make DESTDIR=${RPM_BUILD_ROOT} \
GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
CC="$cc" LDFLAGS="$ldflags" \
install
install -d ${RPM_BUILD_ROOT}/etc/init.d
%if 0%{?_with_systemd}
install -d ${RPM_BUILD_ROOT}/usr/lib/systemd/system/
%else
install -d ${RPM_BUILD_ROOT}/etc/init.d
%endif
install -d ${RPM_BUILD_ROOT}/etc/cron.d
install -d ${RPM_BUILD_ROOT}/etc/cron.daily
install -d ${RPM_BUILD_ROOT}/etc/logrotate.d
@ -236,8 +249,15 @@ install -m 600 Scripts/sogo.cron ${RPM_BUILD_ROOT}/etc/cron.d/sogo
cp Scripts/tmpwatch ${RPM_BUILD_ROOT}/etc/cron.daily/sogo-tmpwatch
chmod 755 ${RPM_BUILD_ROOT}/etc/cron.daily/sogo-tmpwatch
cp Scripts/logrotate ${RPM_BUILD_ROOT}/etc/logrotate.d/sogo
cp Scripts/sogo-init.d-redhat ${RPM_BUILD_ROOT}/etc/init.d/sogod
chmod 755 ${RPM_BUILD_ROOT}/etc/init.d/sogod
%if 0%{?_with_systemd}
cp Scripts/sogo-systemd-redhat ${RPM_BUILD_ROOT}/usr/lib/systemd/system/sogod.service
chmod 644 ${RPM_BUILD_ROOT}/usr/lib/systemd/system/sogod.service
%else
cp Scripts/sogo-init.d-redhat ${RPM_BUILD_ROOT}/etc/init.d/sogod
chmod 755 ${RPM_BUILD_ROOT}/etc/init.d/sogod
%endif
cp Scripts/sogo-default ${RPM_BUILD_ROOT}/etc/sysconfig/sogo
rm -rf ${RPM_BUILD_ROOT}%{_bindir}/test_quick_extract
@ -365,14 +385,24 @@ fi
%post
# update timestamp on imgs,css,js to let apache know the files changed
find %{_libdir}/GNUstep/SOGo/WebServerResources -exec touch {} \;
/sbin/chkconfig --add sogod
/etc/init.d/sogod condrestart >&/dev/null
%if 0%{?_with_systemd}
systemctl enable sogod
systemctl start sogod > /dev/null 2>&1
%else
/sbin/chkconfig --add sogod
/etc/init.d/sogod condrestart >&/dev/null
%endif
%preun
if [ "$1" == "0" ]
then
/sbin/chkconfig --del sogod
/sbin/service sogod stop > /dev/null 2>&1
%if 0%{?_with_systemd}
systemctl disable sogod
systemctl stop sogod > /dev/null 2>&1
%else
/sbin/chkconfig --del sogod
/sbin/service sogod stop > /dev/null 2>&1
%endif
fi
%postun
@ -387,6 +417,9 @@ fi
# ********************************* changelog *************************
%changelog
* Thu Mar 31 2015. Inverse inc. <support@inverse.ca>
- Change script start sogod for systemd
* Wed Oct 8 2014 Inverse inc. <support@inverse.ca>
- fixed the library move to "sogo" app dir