mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +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
|
||||
# Small daemon to identify this machine to the OpenVPN server
|
||||
|
||||
HANDLE=
|
||||
UUID=
|
||||
if [ -f /etc/iiab/openvpn_handle ]; then
|
||||
#HANDLE=
|
||||
#UUID=
|
||||
#if [ -f /etc/iiab/openvpn_handle ]; then
|
||||
# Option #1: Source directly from /etc/iiab/local_vars.yml in future?
|
||||
# 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
|
||||
# (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 \
|
||||
# '{ if((toupper($1) == "HANDLE") && ($2 == "=")) { print $3;}}'`
|
||||
# fi
|
||||
fi
|
||||
#fi
|
||||
HANDLE=${HANDLE// /_}
|
||||
if [ -f /etc/iiab/uuid ]; then
|
||||
UUID=`cat /etc/iiab/uuid`
|
||||
fi
|
||||
#if [ -f /etc/iiab/uuid ]; then
|
||||
UUID=$(cat /etc/iiab/uuid) # Set to "" if file doesn't exist
|
||||
#fi
|
||||
|
||||
SERVER=/usr/bin/ncat
|
||||
ID=`printf "HANDLE = %s|UUID = %s" $HANDLE $UUID`
|
||||
# August 2018: Removal of trailing slash tested on Raspbian, Ubuntu 18.04 & Ubuntu 16.04
|
||||
#ID=$(printf "HANDLE = %s|UUID = %s" $HANDLE $UUID)
|
||||
#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`
|
||||
|
||||
# Start the daemon which will serve the handle on demand
|
||||
|
|
Loading…
Reference in a new issue