From b0c3b13822c7bdbae3f2bdcfc995c0492c4270b9 Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Feb 28 2012 14:25:16 +0000 Subject: Migrate to systemd. --- diff --git a/hostapd.service b/hostapd.service new file mode 100644 index 0000000..ce5f8a7 --- /dev/null +++ b/hostapd.service @@ -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 diff --git a/hostapd.spec b/hostapd.spec index f7aa034..f1791a6 100644 --- a/hostapd.spec +++ b/hostapd.spec @@ -1,13 +1,13 @@ Name: hostapd Version: 0.7.3 -Release: 4%{?dist} +Release: 5%{?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}.init +Source1: %{name}.service Source2: %{name}.conf Source3: %{name}.sysconfig Patch0: hostapd-RPM_OPT_FLAGS.patch @@ -15,11 +15,13 @@ Patch0: hostapd-RPM_OPT_FLAGS.patch BuildRequires: libnl-devel >= 1.1 BuildRequires: openssl-devel -Requires(post): chkconfig -Requires(preun): chkconfig -# This is for /sbin/service -Requires(preun): initscripts - +#Requires(post): chkconfig +#Requires(preun): chkconfig +## This is for /sbin/service +#Requires(preun): initscripts +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units %description 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} # init scripts -install -d %{buildroot}/%{_initddir} -install -pm 0755 %{SOURCE1} %{buildroot}/%{_initddir}/hostapd +install -d %{buildroot}/%{_unitdir} +install -pm 0755 %{SOURCE1} %{buildroot}/%{_unitdir}/hostapd.service # logwatch files install -d %{buildroot}/%{_sysconfdir}/logwatch/conf/services @@ -112,7 +114,7 @@ rm -rf %{buildroot} %doc hostapd/hostapd.vlan hostapd/hostapd.wpa_psk %config(noreplace) %{_sysconfdir}/%{name}/hostapd.conf %config(noreplace) %{_sysconfdir}/sysconfig/hostapd -%{_initddir}/hostapd +%{_unitdir}/hostapd.service %{_sbindir}/hostapd %{_sbindir}/hostapd_cli %dir %{_sysconfdir}/%{name} @@ -128,17 +130,45 @@ rm -rf %{buildroot} %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 -if [ $1 = 0 ]; then - /sbin/service %{name} stop >/dev/null 2>&1 - /sbin/chkconfig --del %{name} +#if [ $1 = 0 ]; then +# /sbin/service %{name} stop >/dev/null 2>&1 +# /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 + +%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 +* Tue Feb 28 2012 Jon Ciesla - 0.7.3-5 +- Migrate to systemd, BZ 770310. + * Wed Jan 18 2012 John W. Linville - 0.7.3-4 - Add reference to sample hostapd.conf in the default installed version - Include README-WPS from the hostapd distribution as part of the docs