Migrate to systemd.

This commit is contained in:
Jon Ciesla 2012-02-28 08:25:16 -06:00
parent 72a6d75443
commit b0c3b13822
2 changed files with 56 additions and 15 deletions

11
hostapd.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
After=network.target
[Service]
Type=forking
PIDFile=/run/hostapd.pid
ExecStart=/usr/sbin/hostapd /etc/hostapd.conf -P /run/hostapd.pid -B
[Install]
WantedBy=multi-user.target

View File

@ -1,13 +1,13 @@
Name: hostapd Name: hostapd
Version: 0.7.3 Version: 0.7.3
Release: 4%{?dist} Release: 5%{?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 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) 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}.init Source1: %{name}.service
Source2: %{name}.conf Source2: %{name}.conf
Source3: %{name}.sysconfig Source3: %{name}.sysconfig
Patch0: hostapd-RPM_OPT_FLAGS.patch Patch0: hostapd-RPM_OPT_FLAGS.patch
@ -15,11 +15,13 @@ Patch0: hostapd-RPM_OPT_FLAGS.patch
BuildRequires: libnl-devel >= 1.1 BuildRequires: libnl-devel >= 1.1
BuildRequires: openssl-devel BuildRequires: openssl-devel
Requires(post): chkconfig #Requires(post): chkconfig
Requires(preun): chkconfig #Requires(preun): chkconfig
# This is for /sbin/service ## This is for /sbin/service
Requires(preun): initscripts #Requires(preun): initscripts
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description %description
hostapd is a user space daemon for access point and authentication hostapd is a user space daemon for access point and authentication
@ -62,8 +64,8 @@ make %{?_smp_mflags} EXTRA_CFLAGS="$RPM_OPT_FLAGS"
rm -rf %{buildroot} rm -rf %{buildroot}
# init scripts # init scripts
install -d %{buildroot}/%{_initddir} install -d %{buildroot}/%{_unitdir}
install -pm 0755 %{SOURCE1} %{buildroot}/%{_initddir}/hostapd install -pm 0755 %{SOURCE1} %{buildroot}/%{_unitdir}/hostapd.service
# logwatch files # logwatch files
install -d %{buildroot}/%{_sysconfdir}/logwatch/conf/services install -d %{buildroot}/%{_sysconfdir}/logwatch/conf/services
@ -112,7 +114,7 @@ rm -rf %{buildroot}
%doc hostapd/hostapd.vlan hostapd/hostapd.wpa_psk %doc hostapd/hostapd.vlan hostapd/hostapd.wpa_psk
%config(noreplace) %{_sysconfdir}/%{name}/hostapd.conf %config(noreplace) %{_sysconfdir}/%{name}/hostapd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/hostapd %config(noreplace) %{_sysconfdir}/sysconfig/hostapd
%{_initddir}/hostapd %{_unitdir}/hostapd.service
%{_sbindir}/hostapd %{_sbindir}/hostapd
%{_sbindir}/hostapd_cli %{_sbindir}/hostapd_cli
%dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}
@ -128,17 +130,45 @@ rm -rf %{buildroot}
%post %post
/sbin/chkconfig --add %{name} #/sbin/chkconfig --add %{name}
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun %preun
if [ $1 = 0 ]; then #if [ $1 = 0 ]; then
/sbin/service %{name} stop >/dev/null 2>&1 # /sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name} # /sbin/chkconfig --del %{name}
#fi
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable hostapd.service > /dev/null 2>&1 || :
/bin/systemctl stop hostapd.service > /dev/null 2>&1 || :
fi fi
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart hostapd.service >/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 ||:
# 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
* Tue Feb 28 2012 Jon Ciesla <limburgher@gmail.com> - 0.7.3-5
- Migrate to systemd, BZ 770310.
* Wed Jan 18 2012 John W. Linville <linville@redhat.com> - 0.7.3-4 * Wed Jan 18 2012 John W. Linville <linville@redhat.com> - 0.7.3-4
- Add reference to sample hostapd.conf in the default installed version - Add reference to sample hostapd.conf in the default installed version
- Include README-WPS from the hostapd distribution as part of the docs - Include README-WPS from the hostapd distribution as part of the docs