summaryrefslogtreecommitdiff
path: root/aports/hostapd/hostapd.initd
blob: a7b603342de4f1a79eebb7210cff38e4f3f08422 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/sbin/openrc-run

name="hostapd"
description="User space daemon for access point and authentication servers"

extra_started_commands="reload"

# $CONFIGS and $OPTIONS are deprecated since Alpine v3.17.
# NOTE: cfgfile can contain more than one file path in this case.
: ${cfgfile:=${CONFIGS:-"/etc/hostapd/hostapd.conf"}}

command="/usr/sbin/hostapd"
command_args="${command_args:-$OPTIONS} $cfgfile"
command_background="yes"
pidfile="/run/$RC_SVCNAME.pid"

required_files="$cfgfile"

depend() {
	need net
	after firewall
	use logger
}

reload() {
	ebegin "Reloading $name configuration"

	if [ "$supervisor" ]; then
		$supervisor "$RC_SVCNAME" --signal HUP
	else
		start-stop-daemon --signal HUP --pidfile "$pidfile"
	fi
	eend $?
}