Accepting request 805688 from network:utilities

OBS-URL: https://build.opensuse.org/request/show/805688
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hostname?expand=0&rev=8
This commit is contained in:
Dominique Leuenberger 2020-05-19 12:43:05 +00:00 committed by Git OBS Bridge
commit dee46fb18f
4 changed files with 48 additions and 1 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sun Apr 12 14:06:27 UTC 2020 - Neal Gompa <ngompa13@gmail.com>
- Add nis-domainname.service for FreeIPA
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Oct 18 03:10:44 UTC 2018 - sean@suspend.net Thu Oct 18 03:10:44 UTC 2018 - sean@suspend.net

View File

@ -23,7 +23,11 @@ Summary: Utility to Set/Show the Host Name or Domain Name
License: GPL-2.0-or-later License: GPL-2.0-or-later
Group: Productivity/Networking/Other Group: Productivity/Networking/Other
Url: https://tracker.debian.org/pkg/hostname Url: https://tracker.debian.org/pkg/hostname
Source: http://http.debian.net/debian/pool/main/h/%{name}/%{name}_%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: http://http.debian.net/debian/pool/main/h/%{name}/%{name}_%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: nis-domainname
Source2: nis-domainname.service.in
BuildRequires: gcc
BuildRequires: systemd-rpm-macros
# net-tools requires hostname, but we know we do not rely on ourselves to build # net-tools requires hostname, but we know we do not rely on ourselves to build
#!BuildIgnore: hostname #!BuildIgnore: hostname
@ -33,6 +37,7 @@ name, and to display or set its hostname or NIS domain name.
%prep %prep
%setup -q -n %{name} %setup -q -n %{name}
cp %{SOURCE1} %{SOURCE2} .
%build %build
make %{?_smp_mflags} CFLAGS="%{optflags} -D_GNU_SOURCE" make %{?_smp_mflags} CFLAGS="%{optflags} -D_GNU_SOURCE"
@ -47,6 +52,17 @@ for prog in dnsdomainname domainname ypdomainname nisdomainname; do
ln -sf %{_bindir}/%{name} %{buildroot}%{_bindir}/$prog ln -sf %{_bindir}/%{name} %{buildroot}%{_bindir}/$prog
ln -sf hostname.1 %{buildroot}%{_mandir}/man1/${prog}.1 ln -sf hostname.1 %{buildroot}%{_mandir}/man1/${prog}.1
done done
sed -e "s|@LIBEXECDIR|%{_libexecdir}|g" nis-domainname.service.in > nis-domainname.service
install -m 0755 -d %{buildroot}%{_libexecdir}/%{name}
install -m 0755 -d %{buildroot}%{_unitdir}
install -p -m 0755 nis-domainname %{buildroot}%{_libexecdir}/%{name}
install -p -m 0644 nis-domainname.service %{buildroot}%{_unitdir}
%post
%systemd_post nis-domainname.service
%preun
%systemd_preun nis-domainname.service
%files %files
%license COPYRIGHT %license COPYRIGHT
@ -66,5 +82,7 @@ done
%{_mandir}/man1/dnsdomainname.1%{ext_man} %{_mandir}/man1/dnsdomainname.1%{ext_man}
%{_mandir}/man1/nisdomainname.1%{ext_man} %{_mandir}/man1/nisdomainname.1%{ext_man}
%{_mandir}/man1/ypdomainname.1%{ext_man} %{_mandir}/man1/ypdomainname.1%{ext_man}
%{_unitdir}/nis-domainname.service
%{_libexecdir}/%{name}/
%changelog %changelog

10
nis-domainname Normal file
View File

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

14
nis-domainname.service.in Normal file
View File

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