From d8330ca4a42a7f5d81b233a1cf7cbc7a7bd0be95 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 20 Sep 2016 18:09:00 +0200 Subject: [PATCH] examples/var_service/supplicant_if: new service example Signed-off-by: Denys Vlasenko --- examples/var_service/supplicant_if/README | 5 ++++ examples/var_service/supplicant_if/log/run | 21 ++++++++++++++ examples/var_service/supplicant_if/p_log | 4 +++ examples/var_service/supplicant_if/run | 21 ++++++++++++++ examples/var_service/supplicant_if/w_log | 4 +++ .../supplicant_if/wpa_supplicant.conf | 28 +++++++++++++++++++ 6 files changed, 83 insertions(+) create mode 100644 examples/var_service/supplicant_if/README create mode 100755 examples/var_service/supplicant_if/log/run create mode 100755 examples/var_service/supplicant_if/p_log create mode 100755 examples/var_service/supplicant_if/run create mode 100755 examples/var_service/supplicant_if/w_log create mode 100644 examples/var_service/supplicant_if/wpa_supplicant.conf 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 @@ +The real README file is one directory up. + +This directory's run script can have useful comments. +If it doesn't but you feel it should, please send a patch +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 @@ +#!/bin/sh + +user=logger + +logdir="/var/log/service/`(cd ..;basename $PWD)`" +mkdir -p "$logdir" 2>/dev/null +chown -R "$user": "$logdir" +chmod -R go-rwxst,u+rwX "$logdir" +rm -rf logdir +ln -s "$logdir" logdir + +# make this dir accessible to logger +chmod a+rX . + +exec >/dev/null +exec 2>&1 +exec \ +env - PATH="$PATH" \ +softlimit \ +setuidgid "$user" \ +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 @@ +#!/bin/sh + +cd log/logdir || exit 1 +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 @@ +#!/bin/sh + +exec 2>&1 +exec &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 @@ +# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group +ctrl_interface=DIR=/var/run/wpa_supplicant +#GROUP=wheel + +# Typical minimal wifi setup: +network={ + ssid="--your-ESSID--" + key_mgmt=WPA-PSK + psk="--your-password--" +} + +# Other fields: +# scan_ssid=1 +# key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE +# pairwise=CCMP TKIP +# group=CCMP TKIP WEP104 WEP40 +# psk="very secret passphrase" +# eap=TTLS PEAP TLS +# identity="user@example.com" +# ca_cert="/etc/cert/ca.pem" +# client_cert="/etc/cert/user.pem" +# private_key="/etc/cert/user.prv" +# private_key_passwd="password" +# phase1="peaplabel=0" +# ca_cert2="/etc/cert/ca2.pem" +# client_cert2="/etc/cer/user.pem" +# private_key2="/etc/cer/user.prv" +# private_key2_passwd="password" -- 2.25.1