blob: 65d46df982a50cc9bd8714252bdda25da10553f4 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh /etc/rc.common
2
3START=19
4STOP=21
5
6USE_PROCD=1
7NAME=wpad
8
9start_service() {
10 if [ -x "/usr/sbin/hostapd" ]; then
11 mkdir -p /var/run/hostapd
12 chown network:network /var/run/hostapd
13 procd_open_instance hostapd
14 procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global
15 procd_set_param respawn 3600 1 0
16 procd_set_param limits core="unlimited"
17 [ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
18 procd_add_jail hostapd
19 procd_set_param capabilities /etc/capabilities/wpad.json
20 procd_set_param user network
21 procd_set_param group network
22 procd_set_param no_new_privs 1
23 }
24 procd_close_instance
25 fi
26
27 if [ -x "/usr/sbin/wpa_supplicant" ]; then
28 mkdir -p /var/run/wpa_supplicant
29 chown network:network /var/run/wpa_supplicant
30 procd_open_instance supplicant
31 procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global
32 procd_set_param respawn 3600 1 0
33 procd_set_param limits core="unlimited"
34 [ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && {
35 procd_add_jail wpa_supplicant
36 procd_set_param capabilities /etc/capabilities/wpad.json
37 procd_set_param user network
38 procd_set_param group network
39 procd_set_param no_new_privs 1
40 }
41 procd_close_instance
42 fi
43}