Add el6 support, spec file formatting

This commit is contained in:
Simone Caronni 2013-08-08 09:27:02 +02:00
parent 0d5f5d034d
commit 476288cf51

View File

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