Require hostname for domainname in pre

Do not crash in pre if /etc/sysconfig/network is missing
This commit is contained in:
Honza Horak 2014-09-05 17:36:15 +02:00
parent 62171f7c1c
commit 3bf9a6bb98

View File

@ -4,7 +4,7 @@ Summary: The NIS (Network Information Service) server
Url: http://www.linux-nis.org/nis/ypserv/index.html Url: http://www.linux-nis.org/nis/ypserv/index.html
Name: ypserv Name: ypserv
Version: 2.32.1 Version: 2.32.1
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: http://www.linux-nis.org/download/ypserv/ypserv-%{version}.tar.bz2 Source0: http://www.linux-nis.org/download/ypserv/ypserv-%{version}.tar.bz2
@ -16,6 +16,8 @@ Source5: yppasswdd-pre-setdomain
Requires: gawk, make, portmap, bash >= 2.0 Requires: gawk, make, portmap, bash >= 2.0
Requires: tokyocabinet Requires: tokyocabinet
# requirement for domainname
Requires(pre): hostname
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
@ -166,7 +168,7 @@ if [ $1 == 2 ] ; then
fi fi
# store old domainname and set the correct one # store old domainname and set the correct one
olddomain=`domainname` olddomain=`domainname`
. /etc/sysconfig/network [ -f /etc/sysconfig/network ] $$ . /etc/sysconfig/network
DOMAINNAME=`domainname` DOMAINNAME=`domainname`
if [ "$olddomain" = "(none)" -o "x$olddomain" = "x" ]; then if [ "$olddomain" = "(none)" -o "x$olddomain" = "x" ]; then
if [ -n "$NISDOMAIN" ]; then if [ -n "$NISDOMAIN" ]; then
@ -224,6 +226,10 @@ fi
%{_includedir}/rpcsvc %{_includedir}/rpcsvc
%changelog %changelog
* Fri Sep 05 2014 Honza Horak <hhorak@redhat.com> - 2.32.1-5
- Require hostname for domainname in pre
Do not crash in pre if /etc/sysconfig/network is missing
* Thu Aug 21 2014 Kevin Fenzi <kevin@scrye.com> - 2.32.1-4 * Thu Aug 21 2014 Kevin Fenzi <kevin@scrye.com> - 2.32.1-4
- Rebuild for rpm bug 1131960 - Rebuild for rpm bug 1131960