convert to systemd

This commit is contained in:
Tom "spot" Callaway 2011-09-19 14:45:57 -04:00
parent 207fa55d00
commit 82129e3a0d
4 changed files with 93 additions and 29 deletions

15
kadmin.service Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=Kerberos 5 Administrative Server
After=syslog.target network.target
ConditionPathExists=/var/kerberos/krb5kdc/principal
ConditionPathExists=!/var/kerberos/krb5kdc/kpropd.acl
[Service]
Type=forking
PIDFile=/var/run/kadmind.pid
EnvironmentFile=-/etc/sysconfig/kadmin
ExecStart=/usr/sbin/kadmind -r $KRB5REALM -P /var/run/kadmind.pid $KADMIND_ARGS
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

11
kprop.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Kerberos 5 Propagation Client
After=syslog.target network.target
ConditionPathExists=!/var/kerberos/krb5kdc/kpropd.acl
[Service]
ExecStart=/usr/sbin/kpropd -S
[Install]
WantedBy=multi-user.target

View File

@ -6,14 +6,14 @@
Summary: The Kerberos network authentication system
Name: krb5
Version: 1.9.1
Release: 12%{?dist}
Release: 13%{?dist}
# Maybe we should explode from the now-available-to-everybody tarball instead?
# http://web.mit.edu/kerberos/dist/krb5/1.9/krb5-1.9.1-signed.tar
Source0: krb5-%{version}.tar.gz
Source1: krb5-%{version}.tar.gz.asc
Source2: kpropd.init
Source4: kadmind.init
Source5: krb5kdc.init
Source2: kprop.service
Source4: kadmin.service
Source5: krb5kdc.service
Source6: krb5.conf
Source10: kdc.conf
Source11: kadm5.acl
@ -76,6 +76,7 @@ BuildRequires: texlive-latex
BuildRequires: keyutils-libs-devel
BuildRequires: libselinux-devel
BuildRequires: pam-devel
BuildRequires: systemd-units
# For the test framework.
BuildRequires: perl, dejagnu, tcl-devel
@ -122,13 +123,16 @@ Kerberos, you need to install this package.
Group: System Environment/Daemons
Summary: The KDC and related programs for Kerberos 5
Requires: %{name}-libs = %{version}-%{release}
Requires(post): /sbin/install-info, chkconfig
Requires(post): /sbin/install-info
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
# we need 'status -l' to work, and that option was added in 8.99
Requires: initscripts >= 8.99-1
# we drop files in its directory, but we don't want to own that directory
Requires: logrotate
Requires(preun): /sbin/install-info, chkconfig, initscripts
Requires(postun): initscripts
Requires(preun): /sbin/install-info
# mktemp is used by krb5-send-pr
Requires: mktemp
# portreserve is used by init scripts for kadmind, kpropd, and krb5kdc
@ -343,7 +347,7 @@ mkdir -p $RPM_BUILD_ROOT/etc
install -pm 644 %{SOURCE6} $RPM_BUILD_ROOT/etc/krb5.conf
# Server init scripts (krb5kdc,kadmind,kpropd) and their sysconfig files.
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
for init in \
%{SOURCE5}\
%{SOURCE4} \
@ -351,9 +355,7 @@ for init in \
# In the past, the init script was supposed to be named after the
# service that the started daemon provided. Changing their names
# is an upgrade-time problem I'm in no hurry to deal with.
service=`basename ${init} .init`
install -pm 755 ${init} \
$RPM_BUILD_ROOT/etc/rc.d/init.d/${service%d}
install -pm 644 ${init} $RPM_BUILD_ROOT%{_unitdir}
done
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
for sysconfig in \
@ -433,12 +435,12 @@ install -m 755 kdb_check_weak $RPM_BUILD_ROOT/%{_libdir}/krb5/
%postun server-ldap -p /sbin/ldconfig
%post server
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
# Remove the init script for older servers.
[ -x /etc/rc.d/init.d/krb5server ] && /sbin/chkconfig --del krb5server
# Install the new ones.
/sbin/chkconfig --add krb5kdc
/sbin/chkconfig --add kadmin
/sbin/chkconfig --add kprop
# Install info pages.
/sbin/install-info %{_infodir}/krb5-admin.info.gz %{_infodir}/dir
/sbin/install-info %{_infodir}/krb5-install.info.gz %{_infodir}/dir
@ -446,24 +448,43 @@ exit 0
%preun server
if [ "$1" -eq "0" ] ; then
/sbin/chkconfig --del krb5kdc
/sbin/chkconfig --del kadmin
/sbin/chkconfig --del kprop
/sbin/service krb5kdc stop > /dev/null 2>&1 || :
/sbin/service kadmin stop > /dev/null 2>&1 || :
/sbin/service kprop stop > /dev/null 2>&1 || :
/bin/systemctl --no-reload disable krb5kdc.service > /dev/null 2>&1 || :
/bin/systemctl --no-reload disable kadmin.service > /dev/null 2>&1 || :
/bin/systemctl --no-reload disable kprop.service > /dev/null 2>&1 || :
/bin/systemctl stop krb5kdc.service > /dev/null 2>&1 || :
/bin/systemctl stop kadmin.service > /dev/null 2>&1 || :
/bin/systemctl stop kprop.service > /dev/null 2>&1 || :
/sbin/install-info --delete %{_infodir}/krb5-admin.info.gz %{_infodir}/dir
/sbin/install-info --delete %{_infodir}/krb5-install.info.gz %{_infodir}/dir
fi
exit 0
%postun server
if [ "$1" -ge 1 ] ; then
/sbin/service krb5kdc condrestart > /dev/null 2>&1 || :
/sbin/service kadmin condrestart > /dev/null 2>&1 || :
/sbin/service kprop condrestart > /dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
/bin/systemctl try-restart krb5kdc.service >/dev/null 2>&1 || :
/bin/systemctl try-restart kadmin.service >/dev/null 2>&1 || :
/bin/systemctl try-restart kprop.service >/dev/null 2>&1 || :
fi
exit 0
%triggerun server -- krb5-server < 1.9.1-13
# Save the current service runlevel info
# User must manually run
# systemd-sysv-convert --apply krb5kdc
# systemd-sysv-convert --apply kadmin
# systemd-sysv-convert --apply kprop
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save krb5kdc >/dev/null 2>&1 ||:
/usr/bin/systemd-sysv-convert --save kadmin >/dev/null 2>&1 ||:
/usr/bin/systemd-sysv-convert --save kprop >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del krb5kdc >/dev/null 2>&1 || :
/sbin/chkconfig --del kadmin >/dev/null 2>&1 || :
/sbin/chkconfig --del kprop >/dev/null 2>&1 || :
/bin/systemctl try-restart krb5kdc.service >/dev/null 2>&1 || :
/bin/systemctl try-restart kadmin.service >/dev/null 2>&1 || :
/bin/systemctl try-restart kprop.service >/dev/null 2>&1 || :
%triggerun server -- krb5-server < 1.6.3-100
if [ "$2" -eq "0" ] ; then
@ -526,9 +547,9 @@ exit 0
%defattr(-,root,root,-)
%docdir %{_mandir}
/etc/rc.d/init.d/krb5kdc
/etc/rc.d/init.d/kadmin
/etc/rc.d/init.d/kprop
%{_unitdir}/krb5kdc.service
%{_unitdir}/kadmin.service
%{_unitdir}/kprop.service
%config(noreplace) /etc/sysconfig/krb5kdc
%config(noreplace) /etc/sysconfig/kadmin
%config(noreplace) /etc/portreserve/kerberos-iv
@ -678,6 +699,9 @@ exit 0
%{_sbindir}/uuserver
%changelog
* Mon Sep 19 2011 Tom Callaway <spot@fedoraproject.org> 1.9.1-13
- convert to systemd
* Tue Sep 6 2011 Nalin Dahyabhai <nalin@redhat.com> 1.9.1-12
- pull in upstream patch for RT#6952, confusion following referrals for
cross-realm auth (#734341)

14
krb5kdc.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=Kerberos 5 Servers
After=syslog.target network.target
[Service]
Type=forking
PIDFile=var/run/krb5kdc.pid
EnvironmentFile=-/etc/sysconfig/krb5kdc
ExecStart=/usr/sbin/krb5kdc -r $KRB5REALM -P $pidfile $KRB5KDC_ARGS
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target