Bug 695736 - Providing native systemd file
This commit is contained in:
parent
19de0cb06f
commit
96d52cc505
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,3 +27,4 @@
|
||||
/389-ds-base-1.2.9.8.tar.bz2
|
||||
/389-ds-base-1.2.9.9.tar.bz2
|
||||
/389-ds-base-1.2.9.10.tar.bz2
|
||||
/389-ds-base-1.2.10.a1.tar.bz2
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
DATE=`date +%Y%m%d`
|
||||
# use a real tag name here
|
||||
VERSION=1.2.9.10
|
||||
VERSION=1.2.10.a1
|
||||
PKGNAME=389-ds-base
|
||||
TAG=${TAG:-$PKGNAME-$VERSION}
|
||||
#SRCNAME=$PKGNAME-$VERSION-$DATE
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
DATE=`date +%Y%m%d`
|
||||
# use a real tag name here
|
||||
VERSION=1.2.9.10
|
||||
VERSION=1.2.10.a1
|
||||
PKGNAME=389-ds-base
|
||||
TAG=${TAG:-$PKGNAME-$VERSION}
|
||||
URL="http://git.fedorahosted.org/git/?p=389/ds.git;a=snapshot;h=$TAG;sf=tgz"
|
||||
|
@ -3,9 +3,9 @@
|
||||
# for a pre-release, define the prerel field e.g. .a1 .rc2 - comment out for official release
|
||||
# also remove the space between % and global - this space is needed because
|
||||
# fedpkg verrel stupidly ignores comment lines
|
||||
# % global prerel .a2
|
||||
%global prerel .a1
|
||||
# also need the relprefix field for a pre-release e.g. .0 - also comment out for official release
|
||||
# % global relprefix 0.
|
||||
%global relprefix 0.
|
||||
|
||||
%global use_openldap 1
|
||||
|
||||
@ -13,10 +13,13 @@
|
||||
# otherwise, comment this out
|
||||
%{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d}
|
||||
|
||||
# systemd support
|
||||
%global groupname %{pkgname}.target
|
||||
|
||||
Summary: 389 Directory Server (base)
|
||||
Name: 389-ds-base
|
||||
Version: 1.2.9.10
|
||||
Release: %{?relprefix}2%{?prerel}%{?dist}
|
||||
Version: 1.2.10
|
||||
Release: %{?relprefix}1%{?prerel}%{?dist}
|
||||
License: GPLv2 with exceptions
|
||||
URL: http://port389.org/
|
||||
Group: System Environment/Daemons
|
||||
@ -49,6 +52,7 @@ BuildRequires: openssl-devel
|
||||
BuildRequires: tcp_wrappers
|
||||
# the following is for the pam passthru auth plug-in
|
||||
BuildRequires: pam-devel
|
||||
BuildRequires: systemd-units
|
||||
|
||||
# this is needed for using semanage from our setup scripts
|
||||
Requires: policycoreutils-python
|
||||
@ -78,9 +82,9 @@ Requires: db4-utils
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
|
||||
# for the init script
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
|
||||
Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2
|
||||
# 389-ds-git.sh should be used to generate the source tarball from git
|
||||
@ -138,7 +142,10 @@ cp %{SOURCE2} README.devel
|
||||
OPENLDAP_FLAG="--with-openldap"
|
||||
%endif
|
||||
%{?with_tmpfiles_d: TMPFILES_FLAG="--with-tmpfiles-d=%{with_tmpfiles_d}"}
|
||||
%configure --enable-autobind --with-selinux $OPENLDAP_FLAG $TMPFILES_FLAG
|
||||
%configure --enable-autobind --with-selinux $OPENLDAP_FLAG $TMPFILES_FLAG \
|
||||
--with-systemdsystemunitdir=%{_unitdir} \
|
||||
--with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \
|
||||
--with-systemdgroupname=%{groupname}
|
||||
|
||||
# Generate symbolic info for debuggers
|
||||
export XCFLAGS=$RPM_OPT_FLAGS
|
||||
@ -159,6 +166,9 @@ mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname}
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname}
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lock/%{pkgname}
|
||||
|
||||
# for systemd
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/%{groupname}.wants
|
||||
|
||||
#remove libtool and static libs
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.a
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.la
|
||||
@ -172,16 +182,16 @@ sed -i -e 's|#{{PERL-EXEC}}|#!/usr/bin/perl|' $RPM_BUILD_ROOT%{_datadir}/%{pkgna
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add %{pkgname}
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
/sbin/ldconfig
|
||||
/sbin/chkconfig --add %{pkgname}-snmp
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then # Final removal
|
||||
/sbin/service %{pkgname} stop >/dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del %{pkgname}
|
||||
/sbin/service %{pkgname}-snmp stop >/dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del %{pkgname}-snmp
|
||||
if [ $1 -eq 0 ]; then # Final removal
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
|
||||
# remove instance specific service files/links
|
||||
rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
@ -191,43 +201,43 @@ if [ $1 = 0 ]; then # Final removal
|
||||
fi
|
||||
|
||||
%posttrans
|
||||
instbase="%{_sysconfdir}/%{pkgname}"
|
||||
# echo posttrans - upgrading - looking for instances in $instbase
|
||||
# find all instances
|
||||
instances="" # instances that require a restart after upgrade
|
||||
ninst=0 # number of instances found in total
|
||||
for dir in $instbase/slapd-* ; do
|
||||
# echo dir = $dir
|
||||
if [ ! -d "$dir" ] ; then continue ; fi
|
||||
case "$dir" in *.removed) continue ;; esac
|
||||
basename=`basename $dir`
|
||||
inst=`echo $basename | sed -e 's/slapd-//g'`
|
||||
# echo found instance $inst - getting status
|
||||
if /sbin/service %{pkgname} status $inst >/dev/null 2>&1 ; then
|
||||
# echo instance $inst is running
|
||||
output=/dev/null
|
||||
if [ -n "$DEBUGPOSTTRANS" ] ; then
|
||||
output=$DEBUGPOSTTRANS
|
||||
fi
|
||||
echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* > $output 2>&1 || :
|
||||
for service in %{_sysconfdir}/systemd/system/%{groupname}.wants/* ; do
|
||||
if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches
|
||||
inst=`echo $service | sed -e 's,%{_sysconfdir}/systemd/system/%{groupname}.wants/,,'`
|
||||
echo found instance $inst - getting status > $output 2>&1 || :
|
||||
if /bin/systemctl -q is-active $inst ; then
|
||||
echo instance $inst is running > $output 2>&1 || :
|
||||
instances="$instances $inst"
|
||||
else
|
||||
# echo instance $inst is not running
|
||||
:
|
||||
echo instance $inst is not running > $output 2>&1 || :
|
||||
fi
|
||||
ninst=`expr $ninst + 1`
|
||||
done
|
||||
if [ $ninst -eq 0 ] ; then
|
||||
echo no instances to upgrade > $output 2>&1 || :
|
||||
exit 0 # have no instances to upgrade - just skip the rest
|
||||
fi
|
||||
# shutdown all instances
|
||||
# echo shutting down all instances . . .
|
||||
/sbin/service %{pkgname} stop > /dev/null 2>&1
|
||||
echo shutting down all instances . . . > $output 2>&1 || :
|
||||
/bin/systemctl stop %{groupname} > $output 2>&1 || :
|
||||
# do the upgrade
|
||||
# echo upgrading instances . . .
|
||||
%{_sbindir}/setup-ds.pl -l /dev/null -u -s General.UpdateMode=offline > /dev/null 2>&1
|
||||
echo upgrading instances . . . > $output 2>&1 || :
|
||||
%{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline > $output 2>&1 || :
|
||||
# restart instances that require it
|
||||
for inst in $instances ; do
|
||||
# echo restarting instance $inst
|
||||
/sbin/service %{pkgname} start $inst >/dev/null 2>&1
|
||||
echo restarting instance $inst > $output 2>&1 || :
|
||||
/bin/systemctl start $inst > $output 2>&1 || :
|
||||
done
|
||||
# restart the snmp subagent if needed
|
||||
/sbin/service %{pkgname}-snmp condrestart > /dev/null 2>&1
|
||||
/bin/systemctl try-restart %{pkgname}-snmp.service > $output 2>&1 || :
|
||||
exit 0
|
||||
|
||||
%files
|
||||
@ -237,14 +247,14 @@ exit 0
|
||||
%dir %{_sysconfdir}/%{pkgname}/schema
|
||||
%config(noreplace)%{_sysconfdir}/%{pkgname}/schema/*.ldif
|
||||
%dir %{_sysconfdir}/%{pkgname}/config
|
||||
%dir %{_sysconfdir}/systemd/system/%{groupname}.wants
|
||||
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/slapd-collations.conf
|
||||
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/certmap.conf
|
||||
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/ldap-agent.conf
|
||||
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/template-initconfig
|
||||
%config(noreplace)%{_sysconfdir}/sysconfig/%{pkgname}
|
||||
%{_datadir}/%{pkgname}
|
||||
%{_sysconfdir}/rc.d/init.d/%{pkgname}
|
||||
%{_sysconfdir}/rc.d/init.d/%{pkgname}-snmp
|
||||
%{_unitdir}
|
||||
%{_bindir}/*
|
||||
%{_sbindir}/*
|
||||
%{_libdir}/%{pkgname}/libns-dshttpd.so*
|
||||
@ -271,6 +281,9 @@ exit 0
|
||||
%{_libdir}/%{pkgname}/libslapd.so.*
|
||||
|
||||
%changelog
|
||||
* Wed Sep 21 2011 Rich Megginson <rmeggins@redhat.com> - 1.2.10.a1-0.1
|
||||
- Bug 695736 - Providing native systemd file
|
||||
|
||||
* Wed Sep 7 2011 Rich Megginson <rmeggins@redhat.com> - 1.2.9.10-2
|
||||
- corrected source
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user