Added a wrapper script to use all variables correctly in the unit file
Resolves: #755775
This commit is contained in:
parent
967a2ed63b
commit
6abb66981e
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
exec /usr/sbin/rpc.yppasswdd -f $YPPASSWDD_ARGS
|
||||||
|
|
|
@ -5,7 +5,7 @@ After=syslog.target network.target rpcbind.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=-/etc/sysconfig/yppasswdd
|
EnvironmentFile=-/etc/sysconfig/yppasswdd
|
||||||
ExecStart=/usr/sbin/rpc.yppasswdd -f $YPPASSWDD_ARGS
|
ExecStart=/usr/sbin/rpc.yppasswdd.env
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
12
ypserv.spec
12
ypserv.spec
|
@ -9,6 +9,7 @@ Source0: ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypserv-%{version}.tar.bz2
|
||||||
Source1: ypserv.service
|
Source1: ypserv.service
|
||||||
Source2: yppasswdd.service
|
Source2: yppasswdd.service
|
||||||
Source3: ypxfrd.service
|
Source3: ypxfrd.service
|
||||||
|
Source4: rpc.yppasswdd.env
|
||||||
|
|
||||||
Requires: gawk, make, portmap, bash >= 2.0
|
Requires: gawk, make, portmap, bash >= 2.0
|
||||||
Requires(post): systemd-units
|
Requires(post): systemd-units
|
||||||
|
@ -110,6 +111,15 @@ cat >$RPM_BUILD_ROOT/etc/sysconfig/yppasswdd <<EOF
|
||||||
YPPASSWDD_ARGS=
|
YPPASSWDD_ARGS=
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# We need to pass all environment variables set in /etc/sysconfig/yppasswdd
|
||||||
|
# only if they are not empty. However, this simple logic is not supported
|
||||||
|
# by systemd. The script rpc.yppasswdd.env wraps the main binary and
|
||||||
|
# prepares YPPASSWDD_ARGS variable to include all necessary variables
|
||||||
|
# (ETCDIR, PASSWDFILE and SHADOWFILE). The script ensures, that the
|
||||||
|
# rpc.yppasswdd arguments are not used when the appropriate environment
|
||||||
|
# variables are empty.
|
||||||
|
install -m755 %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/rpc.yppasswdd.env
|
||||||
|
|
||||||
%post
|
%post
|
||||||
# Package with native systemd unit file is installed for the first time
|
# Package with native systemd unit file is installed for the first time
|
||||||
if [ $1 -eq 1 ]; then
|
if [ $1 -eq 1 ]; then
|
||||||
|
@ -161,6 +171,8 @@ exit 0
|
||||||
* Thu Nov 24 2011 Honza Horak <hhorak@redhat.com> - 2.26-7
|
* Thu Nov 24 2011 Honza Horak <hhorak@redhat.com> - 2.26-7
|
||||||
- Fixed empty domain handling in ypinit script
|
- Fixed empty domain handling in ypinit script
|
||||||
Resolves: #751427
|
Resolves: #751427
|
||||||
|
- Added a wrapper script to use all variables correctly in the unit file
|
||||||
|
Resolves: #755775
|
||||||
|
|
||||||
* Mon Oct 10 2011 Honza Horak <hhorak@redhat.com> - 2.26-6
|
* Mon Oct 10 2011 Honza Horak <hhorak@redhat.com> - 2.26-6
|
||||||
- Made error messages in yppasswdd more accurate
|
- Made error messages in yppasswdd more accurate
|
||||||
|
|
Loading…
Reference in New Issue