nis-domainname.service moved here from initscripts package

This commit is contained in:
David Kaspar [Dee'Kej] 2018-05-31 12:00:02 +02:00
parent 2896b54f7c
commit 1a7d946d60
3 changed files with 55 additions and 2 deletions

View File

@ -1,14 +1,19 @@
Summary: Utility to set/show the host name or domain name
Name: hostname
Version: 3.20
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
Group: System Environment/Base
URL: http://packages.qa.debian.org/h/hostname.html
Source0: http://ftp.de.debian.org/debian/pool/main/h/hostname/hostname_%{version}.tar.gz
Source1: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Source2: nis-domainname
Source3: nis-domainname.service
BuildRequires: gcc
# NOTE: We are *not* requiring systemd on purpose, because we want to allow
# hostname package to be installed in containers without the systemd.
# Initial changes
Patch1: hostname-rh.patch
@ -18,7 +23,7 @@ DNS name, and to display or set its hostname or NIS domain name.
%prep
%setup -q -n hostname
cp %{SOURCE1} .
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} .
%patch1 -p1
%build
@ -27,14 +32,38 @@ make CFLAGS="%{optflags} $CFLAGS -D_GNU_SOURCE" LDFLAGS="$RPM_LD_FLAGS"
%install
make BASEDIR=%{buildroot} BINDIR=%{_bindir} install
install -m 0755 -d %{buildroot}%{_libexecdir}/%{name}
install -m 0755 -d %{buildroot}%{_prefix}/lib/systemd/system
install -m 0755 nis-domainname %{buildroot}%{_libexecdir}/%{name}
install -m 0644 nis-domainname.service %{buildroot}%{_prefix}/lib/systemd/system
%post
if [ $1 -eq 1 ]; then
# Initial installation...
systemctl --no-reload preset nis-domainname.service &>/dev/null || :
fi
%preun
if [ $1 -eq 0 ]; then
# Package removal, not upgrade...
systemctl --no-reload disable --now nis-domainname.service &>/dev/null || :
fi
# NOTE: Nothing to do for upgrade (in postun), nis-domainname.service is oneshot.
%files
%doc COPYRIGHT
%{!?_licensedir:%global license %%doc}
%license gpl-2.0.txt
%{_bindir}/*
%{_mandir}/man1/*
%{_prefix}/lib/systemd/system/*
%{_libexecdir}/%{name}/*
%changelog
* Thu May 31 2018 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 3.20-5
- nis-domainname.service moved here from initscripts package
* Wed Mar 7 2018 Pavel Zhukov <pzhukov@redhat.com> - 3.20-4
- Add gcc to BuildRequires

10
nis-domainname Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/bash
source /etc/sysconfig/network
if [ -n "${NISDOMAIN}" ] && [ -x /usr/bin/nisdomainname ]; then
nisdomainname ${NISDOMAIN}
exit $?
fi
exit 0

14
nis-domainname.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=Read and set NIS domainname from /etc/sysconfig/network
Before=ypbind.service yppasswdd.service ypserv.service ypxfrd.service sysinit.target
DefaultDependencies=no
Conflicts=shutdown.target
ConditionPathExists=/etc/sysconfig/network
[Service]
ExecStart=/usr/libexec/hostname/nis-domainname
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=sysinit.target