From 476288cf51ab53bf185d46fe3e06e1126104c3ad Mon Sep 17 00:00:00 2001 From: Simone Caronni Date: Aug 08 2013 07:27:02 +0000 Subject: Add el6 support, spec file formatting --- diff --git a/hostapd.spec b/hostapd.spec index 37b8427..a39bb28 100644 --- a/hostapd.spec +++ b/hostapd.spec @@ -2,43 +2,52 @@ Name: hostapd Version: 2.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator -Group: System Environment/Daemons License: BSD URL: http://w1.fi/hostapd -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + Source0: http://w1.fi/releases/%{name}-%{version}.tar.gz Source1: %{name}.service Source2: %{name}.conf Source3: %{name}.sysconfig -Patch0: hostapd-RPM_OPT_FLAGS.patch -Patch1: hostapd-EAP-TLS-server-Fix-TLS-Message-Length-validation.patch +Source4: %{name}.init +Patch0: %{name}-RPM_OPT_FLAGS.patch +Patch1: %{name}-EAP-TLS-server-Fix-TLS-Message-Length-validation.patch BuildRequires: libnl-devel >= 1.1 BuildRequires: openssl-devel -BuildRequires: systemd-units -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd +%if 0%{?fedora} || 0%{?rhel} >= 7 +BuildRequires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%endif + +%if 0%{?rhel} == 6 +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service +Requires(postun): /sbin/service +%endif %description -hostapd is a user space daemon for access point and authentication -servers. It implements IEEE 802.11 access point management, IEEE -802.1X/WPA/WPA2/EAP Authenticators and RADIUS authentication server. +%{name} is a user space daemon for access point and authentication servers. It +implements IEEE 802.11 access point management, IEEE 802.1X/WPA/WPA2/EAP +Authenticators and RADIUS authentication server. -hostapd is designed to be a "daemon" program that runs in the back- -ground and acts as the backend component controlling authentication. -hostapd supports separate frontend programs and an example text-based -frontend, hostapd_cli, is included with hostapd. +%{name} is designed to be a "daemon" program that runs in the back-ground and +acts as the backend component controlling authentication. %{name} supports +separate frontend programs and an example text-based frontend, hostapd_cli, is +included with %{name}. %package logwatch -Summary: Logwatch scripts for hostapd -Requires: %{name} = %{version}-%{release} logwatch perl -%description logwatch -Logwatch scripts for hostapd +Summary: Logwatch scripts for hostapd +Requires: %{name} = %{version}-%{release} logwatch perl +%description logwatch +Logwatch scripts for hostapd. %prep %setup -q @@ -51,8 +60,7 @@ Logwatch scripts for hostapd %patch1 -p1 # Prepare default config file -cat %{SOURCE2} | sed -e 's/HOSTAPD_VERSION/'%{version}'/' > hostapd.conf - +cat %{SOURCE2} | sed -e 's/HOSTAPD_VERSION/'%{version}'/' > %{name}.conf %build cd hostapd @@ -63,93 +71,110 @@ cat defconfig | sed -e '/^#CONFIG_DRIVER_NL80211=y/s/^#//' \ -e '/^#CONFIG_IEEE80211N=y/s/^#//' > .config make %{?_smp_mflags} EXTRA_CFLAGS="$RPM_OPT_FLAGS" - %install -rm -rf %{buildroot} +%if 0%{?fedora} || 0%{?rhel} >= 7 + +# Systemd unit files +install -p -m 644 -D %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service -# init scripts -install -d %{buildroot}/%{_unitdir} -install -pm 0755 %{SOURCE1} %{buildroot}/%{_unitdir}/hostapd.service +%else + +# Initscripts +install -p -m 755 -D %{SOURCE4} %{buildroot}%{_initrddir}/%{name} + +%endif # logwatch files install -d %{buildroot}/%{_sysconfdir}/logwatch/conf/services -install -pm 0644 hostapd/logwatch/hostapd.conf \ - %{buildroot}/%{_sysconfdir}/logwatch/conf/services/hostapd.conf +install -pm 0644 %{name}/logwatch/%{name}.conf \ + %{buildroot}/%{_sysconfdir}/logwatch/conf/services/%{name}.conf install -d %{buildroot}/%{_sysconfdir}/logwatch/scripts/services -install -pm 0755 hostapd/logwatch/hostapd \ - %{buildroot}/%{_sysconfdir}/logwatch/scripts/services/hostapd +install -pm 0755 %{name}/logwatch/%{name} \ + %{buildroot}/%{_sysconfdir}/logwatch/scripts/services/%{name} # config files install -d %{buildroot}/%{_sysconfdir}/%{name} -install -pm 0600 hostapd.conf %{buildroot}/%{_sysconfdir}/%{name}/hostapd.conf +install -pm 0600 %{name}.conf %{buildroot}/%{_sysconfdir}/%{name}/%{name}.conf install -d %{buildroot}/%{_sysconfdir}/sysconfig -install -pm 0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/hostapd +install -pm 0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/%{name} # binaries install -d %{buildroot}/%{_sbindir} -install -pm 0755 hostapd/hostapd %{buildroot}%{_sbindir}/hostapd -install -pm 0755 hostapd/hostapd_cli %{buildroot}%{_sbindir}/hostapd_cli +install -pm 0755 %{name}/%{name} %{buildroot}%{_sbindir}/%{name} +install -pm 0755 %{name}/%{name}_cli %{buildroot}%{_sbindir}/%{name}_cli # man pages install -d %{buildroot}%{_mandir}/man{1,8} -install -pm 0644 hostapd/hostapd_cli.1 %{buildroot}%{_mandir}/man1 -install -pm 0644 hostapd/hostapd.8 %{buildroot}%{_mandir}/man8 +install -pm 0644 %{name}/%{name}_cli.1 %{buildroot}%{_mandir}/man1 +install -pm 0644 %{name}/%{name}.8 %{buildroot}%{_mandir}/man8 # prepare docs -cp hostapd/README ./README.hostapd -cp hostapd/README-WPS ./README-WPS.hostapd -cp hostapd/logwatch/README ./README.logwatch +cp %{name}/README ./README.%{name} +cp %{name}/README-WPS ./README-WPS.%{name} +cp %{name}/logwatch/README ./README.logwatch +%if 0%{?fedora} || 0%{?rhel} >= 7 -%clean -rm -rf %{buildroot} +%post +%systemd_post %{name}.service +%preun +%systemd_preun %{name}.service -%files -%defattr(-,root,root,-) -%doc COPYING README README.hostapd README-WPS.hostapd -%doc hostapd/hostapd.conf hostapd/wired.conf -%doc hostapd/hostapd.accept hostapd/hostapd.deny -%doc hostapd/hostapd.eap_user hostapd/hostapd.radius_clients -%doc hostapd/hostapd.vlan hostapd/hostapd.wpa_psk -%config(noreplace) %{_sysconfdir}/%{name}/hostapd.conf -%config(noreplace) %{_sysconfdir}/sysconfig/hostapd -%{_unitdir}/hostapd.service -%{_sbindir}/hostapd -%{_sbindir}/hostapd_cli -%dir %{_sysconfdir}/%{name} -%{_mandir}/man1/* -%{_mandir}/man8/* +%postun +%systemd_postun_with_restart %{name}.service -%files logwatch -%defattr(-,root,root,-) -%doc hostapd/logwatch/README -%config(noreplace) %{_sysconfdir}/logwatch/conf/services/hostapd.conf -%{_sysconfdir}/logwatch/scripts/services/hostapd +%endif +%if 0%{?rhel} == 6 %post -%systemd_post hostapd.service +/sbin/chkconfig --add %{name} %preun -%systemd_preun hostapd.service +if [ $1 -eq 0 ]; then + /sbin/service %{name} stop >/dev/null 2>&1 || : + /sbin/chkconfig --del %{name} +fi %postun -%systemd_postun_with_restart hostapd.service +if [ $1 -ge 1 ]; then + /sbin/service %{name} condrestart >/dev/null 2>&1 || : +fi -%triggerun -- hostapd < 0.7.3-5 -# Save the current service runlevel info -# User must manually run systemd-sysv-convert --apply hostapd -# to migrate them to systemd targets -/usr/bin/systemd-sysv-convert --save hostapd >/dev/null 2>&1 ||: +%endif -# Run these because the SysV package being removed won't do them -/sbin/chkconfig --del hostapd >/dev/null 2>&1 || : -/bin/systemctl try-restart hostapd.service >/dev/null 2>&1 || : +%files +%doc COPYING README README.hostapd README-WPS.hostapd +%doc %{name}/%{name}.conf %{name}/wired.conf +%doc %{name}/%{name}.accept %{name}/%{name}.deny +%doc %{name}/%{name}.eap_user %{name}/%{name}.radius_clients +%doc %{name}/%{name}.vlan %{name}/%{name}.wpa_psk +%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%{_sbindir}/%{name} +%{_sbindir}/%{name}_cli +%dir %{_sysconfdir}/%{name} +%{_mandir}/man1/* +%{_mandir}/man8/* +%if 0%{?fedora} || 0%{?rhel} >= 7 +%{_unitdir}/%{name}.service +%else +%{_initrddir}/%{name} +%endif +%files logwatch +%doc %{name}/logwatch/README +%config(noreplace) %{_sysconfdir}/logwatch/conf/services/%{name}.conf +%{_sysconfdir}/logwatch/scripts/services/%{name} %changelog +* Wed Aug 07 2013 Simone Caronni - 2.0-4 +- Add EPEL 6 support. +- Remove obsolete EPEL 5 tags. +- Little spec file formatting. + * Sat Aug 03 2013 Fedora Release Engineering - 2.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild