mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Clean/Shorten openvpn/templates/announcer.j2
This commit is contained in:
parent
a98b4ec11d
commit
5c2c13966a
1 changed files with 12 additions and 10 deletions
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
# Small daemon to identify this machine to the OpenVPN server
|
# Small daemon to identify this machine to the OpenVPN server
|
||||||
|
|
||||||
HANDLE=
|
#HANDLE=
|
||||||
UUID=
|
#UUID=
|
||||||
if [ -f /etc/iiab/openvpn_handle ]; then
|
#if [ -f /etc/iiab/openvpn_handle ]; then
|
||||||
# Option #1: Source directly from /etc/iiab/local_vars.yml in future?
|
# Option #1: Source directly from /etc/iiab/local_vars.yml in future?
|
||||||
# Option #2
|
# Option #2
|
||||||
HANDLE=`cat /etc/iiab/openvpn_handle`
|
HANDLE=$(cat /etc/iiab/openvpn_handle) # Set to "" if file doesn't exist
|
||||||
|
|
||||||
# Sourcing a variable from ~4 different places is a recipe for total confusion
|
# Sourcing a variable from ~4 different places is a recipe for total confusion
|
||||||
# (or worse!) Far better to make variable openvpn_handle and file
|
# (or worse!) Far better to make variable openvpn_handle and file
|
||||||
|
@ -25,15 +25,17 @@ if [ -f /etc/iiab/openvpn_handle ]; then
|
||||||
# HANDLE=`cat {{ iiab_ini_file }} | gawk \
|
# HANDLE=`cat {{ iiab_ini_file }} | gawk \
|
||||||
# '{ if((toupper($1) == "HANDLE") && ($2 == "=")) { print $3;}}'`
|
# '{ if((toupper($1) == "HANDLE") && ($2 == "=")) { print $3;}}'`
|
||||||
# fi
|
# fi
|
||||||
fi
|
#fi
|
||||||
HANDLE=${HANDLE// /_}
|
HANDLE=${HANDLE// /_}
|
||||||
if [ -f /etc/iiab/uuid ]; then
|
#if [ -f /etc/iiab/uuid ]; then
|
||||||
UUID=`cat /etc/iiab/uuid`
|
UUID=$(cat /etc/iiab/uuid) # Set to "" if file doesn't exist
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
SERVER=/usr/bin/ncat
|
SERVER=/usr/bin/ncat
|
||||||
ID=`printf "HANDLE = %s|UUID = %s" $HANDLE $UUID`
|
#ID=$(printf "HANDLE = %s|UUID = %s" $HANDLE $UUID)
|
||||||
# August 2018: Removal of trailing slash tested on Raspbian, Ubuntu 18.04 & Ubuntu 16.04
|
#ID=$(echo "HANDLE = ${HANDLE}|UUID = ${UUID}")
|
||||||
|
ID=$(echo "HANDLE = $HANDLE|UUID = $UUID")
|
||||||
|
# August 2018: Removal of trailing '|' tested on Raspbian, Ubuntu 18.04 & Ubuntu 16.04
|
||||||
#ID=`printf "HANDLE = %s|UUID = %s|" $HANDLE $UUID`
|
#ID=`printf "HANDLE = %s|UUID = %s|" $HANDLE $UUID`
|
||||||
|
|
||||||
# Start the daemon which will serve the handle on demand
|
# Start the daemon which will serve the handle on demand
|
||||||
|
|
Loading…
Reference in a new issue