[ypserv] Respect NISDOMAIN environment variable and set domainname if empty Resolves: #699826
Jan Horak
hhorak at fedoraproject.org
Thu Jan 12 15:28:18 UTC 2012
commit 3a5608e845fdc498d3017e2f948738fc68ad23e2
Author: Honza HorĂ¡k <hhorak at redhat.com>
Date: Thu Jan 12 16:15:28 2012 +0100
Respect NISDOMAIN environment variable and set domainname if empty
Resolves: #699826
ypserv-pre-setdomain | 21 +++++++++++++++++++++
ypserv.service | 1 +
ypserv.spec | 24 +++++++++++++++++-------
3 files changed, 39 insertions(+), 7 deletions(-)
---
diff --git a/ypserv-pre-setdomain b/ypserv-pre-setdomain
new file mode 100644
index 0000000..0c1f4e8
--- /dev/null
+++ b/ypserv-pre-setdomain
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# ypserv-domain
+#
+# description: This is part of former ypserv init script, which is used
+# to setup proper domainname before starting ypserv daemon
+# itself. If $NISDOMAIN is not defined, it fails.
+#
+
+DOMAINNAME=`domainname`
+if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
+ echo -n $"Setting NIS domain: "
+ if [ -n "$NISDOMAIN" ]; then
+ domainname $NISDOMAIN
+ echo $"'$NISDOMAIN' (environment variable)"
+ else # no domainname found
+ logger -t ypserv $"domain not found"
+ exit 1
+ fi
+fi
+
diff --git a/ypserv.service b/ypserv.service
index 0868394..0733a70 100644
--- a/ypserv.service
+++ b/ypserv.service
@@ -5,6 +5,7 @@ After=syslog.target network.target rpcbind.service
[Service]
EnvironmentFile=-/etc/sysconfig/network
+ExecStartPre=/usr/lib/ypserv/ypserv-pre-setdomain
ExecStart=/usr/sbin/ypserv -f $YPSERV_ARGS
[Install]
diff --git a/ypserv.spec b/ypserv.spec
index 6b21089..4fe5831 100644
--- a/ypserv.spec
+++ b/ypserv.spec
@@ -2,7 +2,7 @@ Summary: The NIS (Network Information Service) server
Url: http://www.linux-nis.org/nis/ypserv/index.html
Name: ypserv
Version: 2.26
-Release: 9%{?dist}
+Release: 10%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source0: ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypserv-%{version}.tar.bz2
@@ -10,6 +10,7 @@ Source1: ypserv.service
Source2: yppasswdd.service
Source3: ypxfrd.service
Source4: rpc.yppasswdd.env
+Source5: ypserv-pre-setdomain
Requires: gawk, make, portmap, bash >= 2.0
Requires(post): systemd-units
@@ -36,6 +37,9 @@ Patch15: ypserv-2.26-retval.patch
BuildRequires: compat-gdbm-devel
BuildRequires: systemd-units
+# Location where helper scripts are located
+%define scripts_path /usr/lib/%{name}
+
%description
The Network Information Service (NIS) is a system that provides
network information (login names, passwords, home directories, group
@@ -86,11 +90,12 @@ 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%{_unitdir} $RPM_BUILD_ROOT%{_sysconfdir}
-install -m644 etc/ypserv.conf $RPM_BUILD_ROOT%{_sysconfdir}
-install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/ypserv.service
-install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/yppasswdd.service
-install -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/ypxfrd.service
+mkdir -p $RPM_BUILD_ROOT%{_unitdir} $RPM_BUILD_ROOT%{_sysconfdir} $RPM_BUILD_ROOT%{scripts_path}
+install -m 644 etc/ypserv.conf $RPM_BUILD_ROOT%{_sysconfdir}
+install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/ypserv.service
+install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/yppasswdd.service
+install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/ypxfrd.service
+install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{scripts_path}/ypserv-pre-setdomain
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
cat >$RPM_BUILD_ROOT/etc/sysconfig/yppasswdd <<EOF
@@ -120,7 +125,7 @@ EOF
# (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
+install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/rpc.yppasswdd.env
%post
# Package with native systemd unit file is installed for the first time
@@ -164,12 +169,17 @@ exit 0
%config(noreplace) %{_sysconfdir}/sysconfig/yppasswdd
%config(noreplace) /var/yp/*
%{_unitdir}/*
+%{scripts_path}/*
%{_libdir}/yp
%{_sbindir}/*
%{_mandir}/*/*
%{_includedir}/*/*
%changelog
+* Thu Jan 12 2012 Honza Horak <hhorak at redhat.com> - 2.26-10
+- Respect NISDOMAIN environment variable and set domainname if empty
+ Resolves: #699826
+
* Mon Dec 12 2011 Honza Horak <hhorak at redhat.com> - 2.26-9
- Rebuild against compat_gdbm, because gdbm has changed license
to GPLv3+ and it is not compatible with ypserv GPLv2
More information about the scm-commits
mailing list