]> git.pld-linux.org Git - packages/hostapd.git/commitdiff
add systemd units (adapted from debian)
authorJan Palus <atler@pld-linux.org>
Mon, 6 Sep 2021 14:12:43 +0000 (16:12 +0200)
committerJan Palus <atler@pld-linux.org>
Mon, 6 Sep 2021 14:12:43 +0000 (16:12 +0200)
hostapd.service [new file with mode: 0644]
hostapd.spec
hostapd@.service [new file with mode: 0644]

diff --git a/hostapd.service b/hostapd.service
new file mode 100644 (file)
index 0000000..b139519
--- /dev/null
@@ -0,0 +1,16 @@
+[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
index d583081654a2c42e30918e4fc5b3d38cc395cf13..c28235d44567440686bffdb98d181ba059069969 100644 (file)
@@ -1,3 +1,7 @@
+#
+# 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
@@ -9,6 +13,8 @@ Group:         Daemons
 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/
@@ -21,6 +27,7 @@ BuildRequires:        sqlite3-devel >= 3
 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
@@ -77,6 +84,10 @@ install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
 
 # 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
@@ -116,3 +127,7 @@ fi
 %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
diff --git a/hostapd@.service b/hostapd@.service
new file mode 100644 (file)
index 0000000..5be27f8
--- /dev/null
@@ -0,0 +1,16 @@
+[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
This page took 0.096539 seconds and 4 git commands to generate.