--- /dev/null
+[Unit]
+Description=Access point and authentication server for Wi-Fi and Ethernet
+Documentation=man:hostapd(8)
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/run/hostapd.pid
+Restart=on-failure
+RestartSec=2
+Environment=HOSTAPD_CONF=/etc/hostap/hostapd.conf
+EnvironmentFile=-/etc/sysconfig/hostapd
+ExecStart=/sbin/hostapd -B -P /run/hostapd.pid $HOSTAPD_OPTS ${HOSTAPD_CONF}
+
+[Install]
+WantedBy=multi-user.target
+#
+# Conditional build:
+%bcond_without systemd # don't package systemd units
+
Summary: HostAP - acts as an access point
Summary(es.UTF-8): HostAP - actĂșa como un punto de acceso
Summary(pl.UTF-8): HostAP - praca jako access point
Source0: http://w1.fi/releases/%{name}-%{version}.tar.gz
# Source0-md5: f188fc53a495fe7af3b6d77d3c31dee8
Source1: %{name}.init
+Source2: %{name}.service
+Source3: %{name}@.service
Patch0: %{name}-config.patch
Patch1: %{name}-build-time-config.patch
URL: http://w1.fi/hostapd/
Requires(post,preun): /sbin/chkconfig
Requires: openssl >= 1.0.2
Requires: rc-scripts
+%{?with_systemd:Requires: systemd-units >= 38}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
# hostapd hostapd_cli nt_password_hash hlr_auc_gw
install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/hostapd
+%if %{with systemd}
+install -pD %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
+install -pD %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}@.service
+%endif
install -p hostapd/hostapd $RPM_BUILD_ROOT/sbin
install -p hostapd/hostapd_cli $RPM_BUILD_ROOT/sbin
install -p hostapd/nt_password_hash $RPM_BUILD_ROOT/sbin
%attr(754,root,root) /etc/rc.d/init.d/hostapd
%{_mandir}/man1/hostapd_cli.1*
%{_mandir}/man8/hostapd.8*
+%if %{with systemd}
+%{systemdunitdir}/%{name}.service
+%{systemdunitdir}/%{name}@.service
+%endif
--- /dev/null
+[Unit]
+Description=Access point and authentication server for Wi-Fi and Ethernet (%I)
+Documentation=man:hostapd(8)
+After=network.target
+BindsTo=sys-subsystem-net-devices-%i.device
+
+[Service]
+Type=forking
+PIDFile=/run/hostapd.%i.pid
+Restart=on-failure
+RestartSec=2
+EnvironmentFile=-/etc/sysconfig/hostapd
+ExecStart=/sbin/hostapd -B -P /run/hostapd.%i.pid $HOSTAPD_OPTS /etc/hostap/%i.conf
+
+[Install]
+WantedBy=multi-user.target sys-subsystem-net-devices-%i.device