diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-20 18:09:00 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-20 18:09:00 +0200 |
commit | d8330ca4a42a7f5d81b233a1cf7cbc7a7bd0be95 (patch) | |
tree | f33ddab6870a14914852ef40c378c31ccd8e2443 | |
parent | 92d98f0612c147171a0e9e03dd7fdfde890ee9e5 (diff) | |
download | busybox-w32-d8330ca4a42a7f5d81b233a1cf7cbc7a7bd0be95.tar.gz busybox-w32-d8330ca4a42a7f5d81b233a1cf7cbc7a7bd0be95.tar.bz2 busybox-w32-d8330ca4a42a7f5d81b233a1cf7cbc7a7bd0be95.zip |
examples/var_service/supplicant_if: new service example
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | examples/var_service/supplicant_if/README | 5 | ||||
-rwxr-xr-x | examples/var_service/supplicant_if/log/run | 21 | ||||
-rwxr-xr-x | examples/var_service/supplicant_if/p_log | 4 | ||||
-rwxr-xr-x | examples/var_service/supplicant_if/run | 21 | ||||
-rwxr-xr-x | examples/var_service/supplicant_if/w_log | 4 | ||||
-rw-r--r-- | examples/var_service/supplicant_if/wpa_supplicant.conf | 28 |
6 files changed, 83 insertions, 0 deletions
diff --git a/examples/var_service/supplicant_if/README b/examples/var_service/supplicant_if/README new file mode 100644 index 000000000..4ddccb22d --- /dev/null +++ b/examples/var_service/supplicant_if/README | |||
@@ -0,0 +1,5 @@ | |||
1 | The real README file is one directory up. | ||
2 | |||
3 | This directory's run script can have useful comments. | ||
4 | If it doesn't but you feel it should, please send a patch | ||
5 | to busybox's mailing list. | ||
diff --git a/examples/var_service/supplicant_if/log/run b/examples/var_service/supplicant_if/log/run new file mode 100755 index 000000000..69d74b73f --- /dev/null +++ b/examples/var_service/supplicant_if/log/run | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | user=logger | ||
4 | |||
5 | logdir="/var/log/service/`(cd ..;basename $PWD)`" | ||
6 | mkdir -p "$logdir" 2>/dev/null | ||
7 | chown -R "$user": "$logdir" | ||
8 | chmod -R go-rwxst,u+rwX "$logdir" | ||
9 | rm -rf logdir | ||
10 | ln -s "$logdir" logdir | ||
11 | |||
12 | # make this dir accessible to logger | ||
13 | chmod a+rX . | ||
14 | |||
15 | exec >/dev/null | ||
16 | exec 2>&1 | ||
17 | exec \ | ||
18 | env - PATH="$PATH" \ | ||
19 | softlimit \ | ||
20 | setuidgid "$user" \ | ||
21 | svlogd -tt "$logdir" | ||
diff --git a/examples/var_service/supplicant_if/p_log b/examples/var_service/supplicant_if/p_log new file mode 100755 index 000000000..a2521be05 --- /dev/null +++ b/examples/var_service/supplicant_if/p_log | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd log/logdir || exit 1 | ||
4 | cat @* current | $PAGER | ||
diff --git a/examples/var_service/supplicant_if/run b/examples/var_service/supplicant_if/run new file mode 100755 index 000000000..45211e001 --- /dev/null +++ b/examples/var_service/supplicant_if/run | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | exec 2>&1 | ||
4 | exec </dev/null | ||
5 | |||
6 | pwd="$PWD" | ||
7 | |||
8 | if="${PWD##*/dhcp_}" | ||
9 | |||
10 | echo "* Upping iface $if" | ||
11 | ip link set dev "$if" up | ||
12 | |||
13 | ##echo "* Powersave disable on $if" | ||
14 | ##iw dev "$if" set power_save off | ||
15 | |||
16 | echo "* Starting wpa_supplicant" | ||
17 | exec \ | ||
18 | env - PATH="$PATH" \ | ||
19 | softlimit \ | ||
20 | setuidgid root \ | ||
21 | wpa_supplicant -i "$if" -c "$pwd/wpa_supplicant.conf" -d | ||
diff --git a/examples/var_service/supplicant_if/w_log b/examples/var_service/supplicant_if/w_log new file mode 100755 index 000000000..aa36ef13b --- /dev/null +++ b/examples/var_service/supplicant_if/w_log | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd log/logdir || exit 1 | ||
4 | watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))' | ||
diff --git a/examples/var_service/supplicant_if/wpa_supplicant.conf b/examples/var_service/supplicant_if/wpa_supplicant.conf new file mode 100644 index 000000000..5fc96b4da --- /dev/null +++ b/examples/var_service/supplicant_if/wpa_supplicant.conf | |||
@@ -0,0 +1,28 @@ | |||
1 | # allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group | ||
2 | ctrl_interface=DIR=/var/run/wpa_supplicant | ||
3 | #GROUP=wheel | ||
4 | |||
5 | # Typical minimal wifi setup: | ||
6 | network={ | ||
7 | ssid="--your-ESSID--" | ||
8 | key_mgmt=WPA-PSK | ||
9 | psk="--your-password--" | ||
10 | } | ||
11 | |||
12 | # Other fields: | ||
13 | # scan_ssid=1 | ||
14 | # key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE | ||
15 | # pairwise=CCMP TKIP | ||
16 | # group=CCMP TKIP WEP104 WEP40 | ||
17 | # psk="very secret passphrase" | ||
18 | # eap=TTLS PEAP TLS | ||
19 | # identity="user@example.com" | ||
20 | # ca_cert="/etc/cert/ca.pem" | ||
21 | # client_cert="/etc/cert/user.pem" | ||
22 | # private_key="/etc/cert/user.prv" | ||
23 | # private_key_passwd="password" | ||
24 | # phase1="peaplabel=0" | ||
25 | # ca_cert2="/etc/cert/ca2.pem" | ||
26 | # client_cert2="/etc/cer/user.pem" | ||
27 | # private_key2="/etc/cer/user.prv" | ||
28 | # private_key2_passwd="password" | ||