Add systemd native services files for ypserv, ypxfrd and yppasswdd

(#696903)
This commit is contained in:
Honza Horák 2011-05-10 16:06:31 +02:00
parent fd1ccec35d
commit a5219e4f4a
8 changed files with 341 additions and 396 deletions

10
yppasswdd.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=The yppasswdd daemon which lets users change their passwords in the presence of NIS (a.k.a. YP)
After=syslog.target network.target rpcbind.service
[Service]
EnvironmentFile=-/etc/sysconfig/yppasswdd
ExecStart=/usr/sbin/rpc.yppasswdd -f $YPPASSWDD_ARGS
[Install]
WantedBy=multi-user.target

263
ypserv-2.25-systemd.patch Normal file
View File

@ -0,0 +1,263 @@
diff -up ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8.systemd ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8
--- ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8.systemd 2011-05-10 14:11:56.272577424 +0200
+++ ypserv-2.25/rpc.yppasswdd/rpc.yppasswdd.8 2011-05-10 14:15:28.822920180 +0200
@@ -14,11 +14,11 @@
rpc.yppasswdd - NIS password update daemon
.SH "SYNOPSIS"
.HP 14
-\fBrpc\.yppasswdd\fR [\-D\ \fIdirectory\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR]
+\fBrpc\.yppasswdd\fR [\-D\ \fIdirectory\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR] [\-f|\-\-foreground]
.HP 14
-\fBrpc\.yppasswdd\fR [\-s\ \fIshadow\fR] [\-p\ \fIpasswd\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR]
+\fBrpc\.yppasswdd\fR [\-s\ \fIshadow\fR] [\-p\ \fIpasswd\fR] \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR] [\-f|\-\-foreground]
.HP 14
-\fBrpc\.yppasswdd\fR \-x\ \fIprogram\fR | \-E\ \fIprogram\fR \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR]
+\fBrpc\.yppasswdd\fR \-x\ \fIprogram\fR | \-E\ \fIprogram\fR \-e\ \fIchsh\fR|\fIchfn\fR [\-\-port\ \fInumber\fR] [\-f|\-\-foreground]
.SH "DESCRIPTION"
.PP
@@ -135,6 +135,11 @@ rpc\.yppasswdd will try to register itse
.RS 4
Prints the version number and if this package is compiled with the CHECKROOT option\.
.RE
+.PP
+\fB\-f\fR, \fB\-\-foreground\fR
+.RS 4
+will not put itself into background\&.
+.RE
.SH "MISCELLANEOUS"
.SS "Shadow Passwords"
.PP
diff -up ypserv-2.25/rpc.yppasswdd/yppasswdd.c.systemd ypserv-2.25/rpc.yppasswdd/yppasswdd.c
--- ypserv-2.25/rpc.yppasswdd/yppasswdd.c.systemd 2011-05-10 14:11:56.258577599 +0200
+++ ypserv-2.25/rpc.yppasswdd/yppasswdd.c 2011-05-10 14:16:40.327026256 +0200
@@ -58,6 +58,8 @@ int allow_chfn = 0;
int solaris_mode = -1;
int x_flag = -1;
+static int foreground_flag = 0;
+
#define xprt_addr(xprt) (svc_getcaller(xprt)->sin_addr)
#define xprt_port(xprt) ntohs(svc_getcaller(xprt)->sin_port)
void yppasswdprog_1 (struct svc_req *rqstp, SVCXPRT * transp);
@@ -110,9 +112,9 @@ yppasswdprog_1 (struct svc_req *rqstp, S
static void
usage (FILE * fp, int n)
{
- fputs ("Usage: rpc.yppasswdd [--debug] [-s shadowfile] [-p passwdfile] [-e chsh|chfn]\n", fp);
- fputs (" rpc.yppasswdd [--debug] [-D directory] [-e chsh|chfn]\n", fp);
- fputs (" rpc.yppasswdd [--debug] [-x program |-E program] [-e chsh|chfn]\n", fp);
+ fputs ("Usage: rpc.yppasswdd [--debug] [-s shadowfile] [-p passwdfile] [-e chsh|chfn] [-f|--foreground]\n", fp);
+ fputs (" rpc.yppasswdd [--debug] [-D directory] [-e chsh|chfn] [-f|--foreground]\n", fp);
+ fputs (" rpc.yppasswdd [--debug] [-x program |-E program] [-e chsh|chfn] [-f|--foreground]\n", fp);
fputs (" rpc.yppasswdd --port number\n", fp);
fputs (" rpc.yppasswdd --version\n", fp);
exit (n);
@@ -200,12 +202,13 @@ main (int argc, char **argv)
{"usage", no_argument, NULL, 'h'},
{"help", no_argument, NULL, 'h'},
{"execute", required_argument, NULL, 'x'},
+ {"foreground", no_argument, NULL, 'f'},
{"debug", no_argument, NULL, '\254'},
{"port", required_argument, NULL, '\253'},
{NULL, 0, NULL, '\0'}
};
- c=getopt_long (argc, argv, "e:p:s:uhvD:E:x:m", long_options,
+ c=getopt_long (argc, argv, "e:p:s:fuhvD:E:x:m", long_options,
&option_index);
if (c == EOF)
break;
@@ -225,6 +228,9 @@ main (int argc, char **argv)
solaris_mode = 0;
path_passwd = optarg;
break;
+ case 'f':
+ foreground_flag = 1;
+ break;
case 's':
if (solaris_mode == 1)
usage (stderr, 1);
@@ -336,7 +342,7 @@ main (int argc, char **argv)
log_msg ("rpc.yppasswdd - NYS YP server version %s\n", VERSION);
#endif /* CHECKROOT */
}
- else
+ else if (!foreground_flag)
{
int i;
diff -up ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8.systemd ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8
--- ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8.systemd 2011-05-10 14:11:56.286577250 +0200
+++ ypserv-2.25/rpc.ypxfrd/rpc.ypxfrd.8 2011-05-10 14:15:19.875032043 +0200
@@ -14,7 +14,7 @@
rpc.ypxfrd - NIS map transfer server
.SH "SYNOPSIS"
.HP 21
-\fB/usr/sbin/rpc\.ypxfrd\fR [\-d\ \fIpath\fR] [\-p\ \fIport\fR] [\-\-debug]
+\fB/usr/sbin/rpc\.ypxfrd\fR [\-d\ \fIpath\fR] [\-p\ \fIport\fR] [\-\-debug] [\-f|\-\-foreground]
.HP 21
\fB/usr/sbin/rpc\.ypxfrd\fR \-\-version
.SH "DESCRIPTION"
@@ -83,6 +83,11 @@ will bind itself to this port, which mak
.RS 4
Prints the version number
.RE
+.PP
+\fB\-f\fR, \fB\-\-foreground\fR
+.RS 4
+will not put itself into background\&.
+.RE
.SH "SECURITY"
.PP
diff -up ypserv-2.25/rpc.ypxfrd/ypxfrd.c.systemd ypserv-2.25/rpc.ypxfrd/ypxfrd.c
--- ypserv-2.25/rpc.ypxfrd/ypxfrd.c.systemd 2011-05-10 14:11:56.258577599 +0200
+++ ypserv-2.25/rpc.ypxfrd/ypxfrd.c 2011-05-10 14:16:26.193202954 +0200
@@ -79,6 +79,8 @@ char *path_ypdb = YPMAPDIR;
char *progname;
+static int foreground_flag = 0;
+
/*
** Needed, if we start rpc.ypxfrd from inetd
*/
@@ -140,7 +142,7 @@ sig_hup (int sig UNUSED)
static void
usage (int exitcode)
{
- fputs ("usage: rpc.ypxfrd [--debug] [-d path] [-p port]\n", stderr);
+ fputs ("usage: rpc.ypxfrd [--debug] [-d path] [-p port] [-f|--foreground]\n", stderr);
fputs (" rpc.ypxfrd --version\n", stderr);
exit (exitcode);
@@ -180,12 +182,13 @@ main (int argc, char **argv)
{"port", required_argument, NULL, 'p'},
{"path", required_argument, NULL, 'd'},
{"dir", required_argument, NULL, 'd'},
+ {"foreground", no_argument, NULL, 'f'},
{"usage", no_argument, NULL, 'u'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, '\0'}
};
- c=getopt_long(argc, argv, "p:d:uh",long_options, &option_index);
+ c=getopt_long(argc, argv, "p:d:fuh",long_options, &option_index);
if (c==EOF) break;
switch (c)
{
@@ -212,6 +215,9 @@ main (int argc, char **argv)
if (debug_flag)
log_msg("Using port %d\n", my_port);
break;
+ case 'f':
+ foreground_flag = 1;
+ break;
case 'u':
case 'h':
usage(0);
@@ -227,8 +233,8 @@ main (int argc, char **argv)
if (debug_flag)
log_msg("[Welcome to the rpc.ypxfrd Daemon, version %s]\n", VERSION);
- else
- if(!_rpcpmstart)
+ else
+ if (!_rpcpmstart && !foreground_flag)
{
int i;
diff -up ypserv-2.25/ypserv/ypserv.8.systemd ypserv-2.25/ypserv/ypserv.8
--- ypserv-2.25/ypserv/ypserv.8.systemd 2011-05-10 14:11:56.295577137 +0200
+++ ypserv-2.25/ypserv/ypserv.8 2011-05-10 14:15:01.646259934 +0200
@@ -22,7 +22,7 @@
ypserv \- NIS Server
.SH "SYNOPSIS"
.HP \w'\fB/usr/sbin/ypserv\fR\ 'u
-\fB/usr/sbin/ypserv\fR [\-d\ [\fIpath\fR]] [\-p\ \fIport\fR]
+\fB/usr/sbin/ypserv\fR [\-d\] [\-p\ \fIport\fR] [\-f|\-\-foreground]
.SH "DESCRIPTION"
.PP
.\" ypserv: ypserv \(em NIS server process
@@ -66,15 +66,11 @@ and this variable can be set in
\fB/etc/sysconfig/network\&.\fR
.SH "OPTIONS"
.PP
-\fB\-d\fR, \fB\-\-debug \fR[\fIpath\fR]
+\fB\-d\fR, \fB\-\-debug
.RS 4
Causes the server to run in debugging mode\&. Normally,
\fBypserv\fR
reports only errors (access violations, dbm failures) using the syslog(3) facility\&. In debug mode, the server does not background itself and prints extra status messages to stderr for each request that it revceives\&.
-\fBpath\fR
-is an optionally parameter\&.
-\fBypserv\fR
-is using this directory instead of /var/yp
.RE
.PP
\fB\-p\fR, \fB\-\-port\fR \fIport\fR
@@ -87,6 +83,11 @@ will bind itself to this port\&. This ma
.RS 4
Prints the version number
.RE
+.PP
+\fB\-f\fR, \fB\-\-foreground\fR
+.RS 4
+will not put itself into background\&.
+.RE
.SH "SECURITY"
.PP
In general, any remote user can issue an RPC to
diff -up ypserv-2.25/ypserv/ypserv.c.systemd ypserv-2.25/ypserv/ypserv.c
--- ypserv-2.25/ypserv/ypserv.c.systemd 2011-05-10 14:11:56.261577563 +0200
+++ ypserv-2.25/ypserv/ypserv.c 2011-05-10 14:16:19.745283563 +0200
@@ -60,6 +60,7 @@
#endif
static char *path_ypdb = YPMAPDIR;
+static int foreground_flag = 0;
static void
ypprog_2 (struct svc_req *rqstp, register SVCXPRT * transp)
@@ -317,7 +318,7 @@ sig_child (int sig UNUSED)
static void
Usage (int exitcode)
{
- fputs ("usage: ypserv [-d [path]] [-p port]\n", stderr);
+ fputs ("usage: ypserv [-d] [-p port] [-f|--foreground]\n", stderr);
fputs (" ypserv --version\n", stderr);
exit (exitcode);
@@ -342,10 +343,11 @@ main (int argc, char **argv)
{"port", required_argument, NULL, 'p'},
{"usage", no_argument, NULL, 'u'},
{"help", no_argument, NULL, 'h'},
+ {"foreground", no_argument, NULL, 'f'},
{NULL, 0, NULL, '\0'}
};
- c = getopt_long (argc, argv, "vdp:buh", long_options, &option_index);
+ c = getopt_long (argc, argv, "vdp:fbuh", long_options, &option_index);
if (c == -1)
break;
switch (c)
@@ -368,6 +370,9 @@ main (int argc, char **argv)
if (debug_flag)
log_msg ("Using port %d\n", my_port);
break;
+ case 'f':
+ foreground_flag = 1;
+ break;
case 'u':
case 'h':
Usage (0);
@@ -383,7 +388,7 @@ main (int argc, char **argv)
if (debug_flag)
log_msg ("[ypserv (%s) %s]\n", PACKAGE, VERSION);
- else
+ else if (! foreground_flag)
{
int i;

View File

@ -1,128 +0,0 @@
#!/bin/sh
#
# yppasswdd: Starts the YP password changing server
#
# Version: @(#) /etc/init.d/yppasswdd 1.0
#
# chkconfig: - 66 34
# description: yppasswdd is the RPC server that lets users change their \
# passwords in the presence of NIS (a.k.a. YP). It must be \
# run on the NIS master server for that NIS domain. The client \
# program is known as yppasswd in most cases.
# processname: rpc.yppasswdd
#
# See https://fedoraproject.org/wiki/Packaging:SysVInitScript for
# the guidelines document.
# Source function library.
[ -f /etc/rc.d/init.d/functions ] || exit 0
. /etc/rc.d/init.d/functions
# getting the YP domain name
. /etc/sysconfig/network
execname="rpc.yppasswdd"
exec="/usr/sbin/$execname"
prog="yppasswdd"
# Get the settings
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
pidfile=/var/run/$prog.pid
if [ "$ETCDIR" ]; then
YPPASSWDD_ARGS="$YPPASSWDD_ARGS -D $ETCDIR"
fi
if [ "$PASSWDFILE" ]; then
YPPASSWDD_ARGS="$YPPASSWDD_ARGS -p $PASSWDFILE"
fi
if [ "$SHADOWFILE" ]; then
YPPASSWDD_ARGS="$YPPASSWDD_ARGS -s $SHADOWFILE"
fi
start() {
[ $UID -eq 0 ] || exit 4
[ -x $exec ] || exit 5
echo -n $"Starting YP passwd service: "
daemon --pidfile=$pidfile $exec $YPPASSWDD_ARGS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
[ $UID -eq 0 ] || exit 4
[ -x $exec ] || exit 5
echo -n $"Stopping YP passwd service: "
killproc -p $pidfile $execname
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
# run checks to determine if the service is running or use generic status
status -p $pidfile -l $prog $execname
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
usage() {
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
usage)
$1
;;
*)
usage
exit 2
esac
exit $?

View File

@ -1,125 +0,0 @@
#!/bin/sh
#
# ypserv: Starts the yp-server
#
# Version: @(#) /etc/init.d/ypserv.init 1.0
#
# Author: Joerg Mertin <smurphy@stargate.bln.sub.org>
#
# chkconfig: - 26 74
# description: ypserv is an implementation of the standard NIS/YP networking \
# protocol. It allows network-wide distribution of hostname, \
# username, and other information databases. This is the NIS \
# server, and is not needed on NIS clients.
# processname: ypserv
# config: /etc/ypserv.conf
#
# See https://fedoraproject.org/wiki/Packaging:SysVInitScript for
# the guidelines document.
# Source function library.
[ -f /etc/rc.d/init.d/functions ] || exit 0
. /etc/rc.d/init.d/functions
# getting the YP domain name
[ -e /etc/sysconfig/network ] && . /etc/sysconfig/network
exec="/usr/sbin/ypserv"
prog="ypserv"
lockfile=/var/lock/subsys/$prog
start() {
[ $UID -eq 0 ] || exit 4
[ -x $exec ] || exit 5
DOMAINNAME=`domainname`
if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
if [ -n "$NISDOMAIN" ]; then
action $"Setting NIS domain name $NISDOMAIN: " domainname $NISDOMAIN
else
exit 1
fi
fi
echo -n $"Starting YP server services: "
daemon $exec $YPSERV_ARGS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
[ $UID -eq 0 ] || exit 4
[ -x $exec ] || exit 5
echo -n $"Stopping YP server services: "
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading securenets and ypserv.conf file:"
killproc $prog -HUP
retval=$?
echo
return $retval
}
force_reload() {
restart
}
rh_status() {
# run checks to determine if the service is running or use generic status
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
usage() {
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
usage)
$1
;;
*)
usage
exit 2
esac
exit $?

View File

@ -1,115 +0,0 @@
#!/bin/sh
#
# ypxfrd: Starts the ypxfrd daemon
#
# Version: @(#) /etc/init.d/ypxfrd 1.0
#
# chkconfig: - 26 74
# description: ypxfrd should be started in addition to ypserv to accelerate \
# transferring yp maps.
# processname: ypxfrd
#
# See https://fedoraproject.org/wiki/Packaging:SysVInitScript for
# the guidelines document.
# Source function library.
[ -f /etc/rc.d/init.d/functions ] || exit 0
. /etc/rc.d/init.d/functions
# getting the YP domain name
. /etc/sysconfig/network
execname="rpc.ypxfrd"
exec="/usr/sbin/$execname"
prog="ypxfrd"
lockfile=/var/lock/subsys/$prog
pidfile=/var/run/$prog.pid
start() {
[ $UID -eq 0 ] || exit 4
[ -x $exec ] || exit 5
echo -n $"Starting YP map server: "
daemon --pidfile=$pidfile $exec $YPXFRD_ARGS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
[ $UID -eq 0 ] || exit 4
[ -x $exec ] || exit 5
echo -n $"Stopping YP map server: "
killproc -p $pidfile $execname
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading securenets and ypserv.conf file:"
killproc -p $pidfile $execname -HUP
retval=$?
echo
return $retval
}
force_reload() {
restart
}
rh_status() {
# run checks to determine if the service is running or use generic status
status -p $pidfile -l $prog $execname
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
usage() {
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
}
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
usage)
$1
;;
*)
usage
exit 2
esac
exit $?

10
ypserv.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=The NIS (Network Information Service) server
After=syslog.target network.target rpcbind.service
[Service]
EnvironmentFile=-/etc/sysconfig/network
ExecStart=/usr/sbin/ypserv -f $YPSERV_ARGS
[Install]
WantedBy=multi-user.target

View File

@ -2,20 +2,18 @@ Summary: The NIS (Network Information Service) server
Url: http://www.linux-nis.org/nis/ypserv/index.html
Name: ypserv
Version: 2.25
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source0: ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypserv-%{version}.tar.bz2
Source1: ypserv-ypserv.init
Source2: ypserv-yppasswdd.init
Source3: ypserv-ypxfrd.init
Source1: ypserv.service
Source2: yppasswdd.service
Source3: ypxfrd.service
Requires: gawk, make, portmap, bash >= 2.0
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
Requires(postun): initscripts
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
Patch0: ypserv-2.5-redhat.patch
Patch1: ypserv-2.21-path.patch
@ -26,6 +24,7 @@ Patch5: ypserv-2.13-nonedomain.patch
Patch6: ypserv-2.19-slp-warning.patch
Patch7: ypserv-2.24-manfix.patch
Patch8: ypserv-2.24-aliases.patch
Patch9: ypserv-2.25-systemd.patch
BuildRequires: gdbm-devel
%description
@ -55,6 +54,7 @@ machines.
%patch6 -p1 -b .slp-warning
%patch7 -p1 -b .manfix
%patch8 -p1 -b .aliases
%patch9 -p1 -b .systemd
%build
cp etc/README etc/README.etc
@ -71,11 +71,11 @@ rm -rf $RPM_BUILD_ROOT
#make install ROOT=$RPM_BUILD_ROOT
%makeinstall libexecdir=$RPM_BUILD_ROOT%{_libdir}/yp INSTALL_PROGRAM=install
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/ $RPM_BUILD_ROOT%{_sysconfdir}
install -m644 etc/ypserv.conf $RPM_BUILD_ROOT%{_sysconfdir}
install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/ypserv
install -m755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/yppasswdd
install -m755 %{SOURCE3} $RPM_BUILD_ROOT%{_initrddir}/ypxfrd
install -m644 %{SOURCE1} $RPM_BUILD_ROOT/lib/systemd/system/ypserv.service
install -m644 %{SOURCE2} $RPM_BUILD_ROOT/lib/systemd/system/yppasswdd.service
install -m644 %{SOURCE3} $RPM_BUILD_ROOT/lib/systemd/system/ypxfrd.service
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
cat >$RPM_BUILD_ROOT/etc/sysconfig/yppasswdd <<EOF
@ -99,25 +99,41 @@ YPPASSWDD_ARGS=
EOF
%post
/sbin/chkconfig --add ypserv
/sbin/chkconfig --add yppasswdd
/sbin/chkconfig --add ypxfrd
# Package with native systemd unit file is installed for the first time
if [ $1 -eq 1 ]; then
# Package install, not upgrade
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%triggerun -- ypserv < 2.25-2
if /sbin/chkconfig --level 3 ypserv ; then
/bin/systemctl --no-reload enable ypserv.service >/dev/null 2>&1 || :
fi
if /sbin/chkconfig --level 3 ypxfrd ; then
/bin/systemctl --no-reload enable ypxfrd.service >/dev/null 2>&1 || :
fi
if /sbin/chkconfig --level 3 yppasswdd ; then
/bin/systemctl --no-reload enable yppasswdd.service >/dev/null 2>&1 || :
fi
%preun
if [ $1 = 0 ]; then
/sbin/service ypserv stop > /dev/null 2>&1
/sbin/chkconfig --del ypserv
/sbin/service yppasswdd stop > /dev/null 2>&1
/sbin/chkconfig --del yppasswdd
/sbin/service ypxfrd stop > /dev/null 2>&1
/sbin/chkconfig --del ypxfrd
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl stop ypserv.service >/dev/null 2>&1 || :
/bin/systemctl --no-reload disable ypserv.service >/dev/null 2>&1 || :
/bin/systemctl stop ypxfrd.service >/dev/null 2>&1 || :
/bin/systemctl --no-reload disable ypxfrd.service >/dev/null 2>&1 || :
/bin/systemctl stop yppasswdd.service >/dev/null 2>&1 || :
/bin/systemctl --no-reload disable yppasswdd.service >/dev/null 2>&1 || :
fi
%postun
if [ "$1" -ge "1" ]; then
/sbin/service ypserv condrestart > /dev/null 2>&1
/sbin/service yppasswdd condrestart > /dev/null 2>&1
/sbin/service ypxfrd condrestart > /dev/null 2>&1
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ "$1" -ge "1" ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart ypserv.service >/dev/null 2>&1 || :
/bin/systemctl try-restart ypxfrd.service >/dev/null 2>&1 || :
/bin/systemctl try-restart yppasswdd.service >/dev/null 2>&1 || :
fi
exit 0
@ -129,13 +145,17 @@ exit 0
%config(noreplace) %{_sysconfdir}/ypserv.conf
%config(noreplace) %{_sysconfdir}/sysconfig/yppasswdd
%config(noreplace) /var/yp/*
%config %{_initrddir}/*
/lib/systemd/system/*
%{_libdir}/yp
%{_sbindir}/*
%{_mandir}/*/*
%{_includedir}/*/*
%changelog
* Wed May 10 2011 Honza Horak <hhorak@redhat.com> - 2.25-2
- Add systemd native services files for ypserv, ypxfrd and yppasswdd
(#696903)
* Wed May 10 2011 Honza Horak <hhorak@redhat.com> - 2.25-1
- Update to new upstream version, which contains .staticanal patch

10
ypxfrd.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=The ypxfrd daemon which accelerates transferring yp maps by ypserv
After=syslog.target network.target rpcbind.service
[Service]
EnvironmentFile=-/etc/sysconfig/network
ExecStart=/usr/sbin/rpc.ypxfrd -f $YPXFRD_ARGS
[Install]
WantedBy=multi-user.target