## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global forgeurl0 https://github.com/NetworkConfiguration/dhcpcd

Name: dhcpcd
Version: 10.0.10
Release: %autorelease
Summary: A minimalistic network configuration daemon with DHCPv4, rdisc and DHCPv6 support
License: BSD-2-Clause AND ISC AND MIT
URL: http://roy.marples.name/projects/%{name}/
# Moved to github
VCS: git:%{forgeurl0}
Source0: %{forgeurl0}/releases/download/v%{version}/%{name}-%{version}.tar.xz
Source1: %{forgeurl0}/releases/download/v%{version}/%{name}-%{version}.tar.xz.asc
Source2: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xa785ed2755955d9e93ea59f6597f97ea9ad45549#/roy-marples.name.asc
Source3: %{name}.service
Source4: %{name}@.service
Source5: systemd-sysusers.conf

BuildRequires: gcc
BuildRequires: systemd-rpm-macros
BuildRequires: chrony
BuildRequires: systemd-devel
%if 0%{?fedora}
# Not in RHEL
BuildRequires: ypbind
%endif
BuildRequires: make
%if 0%{?fedora} || 0%{?rhel} > 8
BuildRequires: gnupg2
%endif
%{?systemd_requires}
%description
The dhcpcd package provides a minimalistic network configuration daemon
that supports IPv4 and IPv6 configuration including configuration discovery
through NDP, DHCPv4 and DHCPv6 protocols.

%prep
%if 0%{?fedora} || 0%{?rhel} > 8
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%endif
%autosetup -p1

%build
%configure \
    --dbdir=/var/lib/%{name} --runstatedir=%{_rundir}
%make_build

%check
%make_build test

%install
export BINMODE=755
%make_install
find %{buildroot} -name '*.la' -delete -print
install -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/%{name}@.service
install -d %{buildroot}%{_sharedstatedir}/%{_name}

%pre
%sysusers_create_compat %{SOURCE5}

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun_with_restart %{name}.service

%files
%license LICENSE
%config(noreplace) %{_sysconfdir}/%{name}.conf
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/hooks
%{_datadir}/%{name}/hooks/10-wpa_supplicant
%{_datadir}/%{name}/hooks/15-timezone
%{_datadir}/%{name}/hooks/29-lookup-hostname
%{_datadir}/%{name}/hooks/50-yp.conf
%{_libdir}/%{name}
%{_libexecdir}/%{name}-hooks
%{_libexecdir}/%{name}-run-hooks
%{_mandir}/man5/%{name}.conf.5.gz
%{_mandir}/man8/%{name}-run-hooks.8.gz
%{_mandir}/man8/%{name}.8.gz
%{_sbindir}/%{name}
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}@.service
%defattr(0644,root,dhcpcd,0755)
%{_sharedstatedir}/%{name}

%changelog
## START: Generated by rpmautospec
* Thu Sep 12 2024 Petr Menšík <pemensik@redhat.com> - 10.0.10-1
- Update to 10.0.10 (rhbz#2307085)

* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 10.0.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Tue Jul 02 2024 Petr Menšík <pemensik@redhat.com> - 10.0.8-1
- Update to 10.0.8 (rhbz#2283240)
- https://github.com/NetworkConfiguration/dhcpcd/releases/tag/v10.0.8
- https://github.com/NetworkConfiguration/dhcpcd/releases/tag/v10.0.7

* Thu Jun 27 2024 František Hrdina <fhrdina@redhat.com> - 10.0.6-5
- Update fmf testing and gating

* Wed Feb 07 2024 Petr Menšík <pemensik@redhat.com> - 10.0.6-4
- Properly skip invalid packets received on wrong interface (#2262996)

* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 10.0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 10.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Dec 21 2023 Martin Osvald <mosvald@redhat.com> - 10.0.6-1
- Update to 10.0.6 (rhbz#2255164)
- fix missing directory ownership and license

* Thu Nov 23 2023 Martin Osvald <mosvald@redhat.com> - 10.0.5-1
- Update to 10.0.5 (rhbz#2249203)

* Wed Oct 25 2023 Pavol Žáčik <zacik.pa@gmail.com> - 10.0.4-1
- Update to 10.04

* Sun Jul 23 2023 Petr Menšík <pemensik@redhat.com> - 10.0.2-7
- More attempts to fix testing of ipv6 too

* Sun Jul 23 2023 Petr Menšík <pemensik@redhat.com> - 10.0.2-6
- Fix building on recent epel

* Sun Jul 23 2023 Petr Menšík <pemensik@redhat.com> - 10.0.2-5
- IPv4 tests fixes

* Sun Jul 23 2023 Petr Menšík <pemensik@redhat.com> - 10.0.2-4
- Use /run directory, build test

* Sun Jul 23 2023 Petr Menšík <pemensik@fedoraproject.org> - 10.0.2-3
- RPMAUTOSPEC: unresolvable merge
## END: Generated by rpmautospec