blob: d8df253e0ccc574c80e3c4ce52569b8144a0044e (
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
|
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=95
STOP=10
start_service() {
source /lib/functions/sentinel.sh
agreed_with_eula || return 1
config_load sentinel
local device_token
config_get device_token main device_token ""
if ! sentinel-device-token --validate "${device_token}" --quite; then
device_token="$(sentinel-device-token --create --quite)";
uci -q set sentinel.main.device_token="${device_token}";
uci -q commit sentinel.main;
echo "New device token created" >&2;
fi
cat > "/tmp/etc/sentinel-proxy.cfg" <<-EOF
device_token = "${device_token}"
EOF
procd_open_instance
procd_set_param command /bin/sh -c 'sentinel-certgen certs --skip-renew && exec sentinel-proxy'
procd_set_param respawn 600 5 5
procd_set_param file /etc/config/sentinel
procd_close_instance
}
|