2015-06-02 12:47:33 +00:00
|
|
|
#!/bin/bash
|
2015-09-07 19:51:00 +00:00
|
|
|
source /usr/src/app/resin-vars
|
2015-08-28 14:06:27 +00:00
|
|
|
sed --expression="s/#{VPN_ENDPOINT}/${VPN_ENDPOINT}/" /etc/openvpn/client.conf.tmpl > /etc/openvpn/client.conf
|
|
|
|
|
2015-06-02 12:47:33 +00:00
|
|
|
while true; do
|
|
|
|
if [ `jq ".uuid | length" $CONFIG_PATH` -eq 0 ]; then
|
|
|
|
echo "UUID missing from config file, VPN cannot connect"
|
|
|
|
sleep 2
|
|
|
|
else
|
2017-06-27 00:17:25 +00:00
|
|
|
read uuid api_key <<<$(jq -r '.uuid,.apiKey // .deviceApiKey' $CONFIG_PATH)
|
2015-06-02 12:47:33 +00:00
|
|
|
mkdir -p /var/volatile/
|
|
|
|
echo $uuid > /var/volatile/vpnfile
|
|
|
|
echo $api_key >> /var/volatile/vpnfile
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|