File hostname.spec of Package hostname

# spec file for package hostname
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           hostname
Version:        3.23
Release:        0
Summary:        Utility to Set/Show the Host Name or Domain Name
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Other
Source1:        nis-domainname
BuildRequires:  gcc
BuildRequires:  systemd-rpm-macros
# net-tools requires hostname, but we know we do not rely on ourselves to build
#!BuildIgnore:  hostname

This package provides commands which can be used to display the system's DNS
name, and to display or set its hostname or NIS domain name.

%setup -q -n %{name}
cp %{SOURCE1} %{SOURCE2} .

make %{?_smp_mflags} CFLAGS="%{optflags} -D_GNU_SOURCE"

install -D -p -m 755 %{name} %{buildroot}%{_bindir}/%{name}
%if !0%{?usrmerged}
install -d -m 755 %{buildroot}/bin/
ln -sf %{_bindir}/%{name} %{buildroot}/bin/%{name}
install -D -p -m 644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
for prog in dnsdomainname domainname ypdomainname nisdomainname; do
%if !0%{?usrmerged}
    ln -sf %{_bindir}/%{name} %{buildroot}/bin/$prog
    ln -sf %{_bindir}/%{name} %{buildroot}%{_bindir}/$prog
    ln -sf hostname.1 %{buildroot}%{_mandir}/man1/${prog}.1
sed -e "s|@LIBEXECDIR@|%{_libexecdir}|g" > 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}

%systemd_post nis-domainname.service

%systemd_preun nis-domainname.service

%license COPYRIGHT
%doc debian/changelog
%if !0%{?usrmerged}

openSUSE Build Service is sponsored by