refactor(scripts): Structure code as per codestyle

Fix #1636
Refactor code according to code style
Constants, Functions, Script
This commit is contained in:
4s3ti 2022-10-08 01:11:10 +02:00
parent 79f7caf4d3
commit 71f7ca9b3b
No known key found for this signature in database
GPG key ID: AC2D3B898F96BC51
20 changed files with 377 additions and 342 deletions

View file

@ -1,5 +1,6 @@
#!/bin/bash
### Constants
PLAT="$(grep -sEe '^NAME\=' /etc/os-release \
| sed -E -e "s/NAME\=[\'\"]?([^ ]*).*/\1/")"
@ -8,10 +9,12 @@ VPN="${1}"
setupVars="/etc/pivpn/${VPN}/setupVars.conf"
ERR=0
### Functions
err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
}
### Script
if [[ ! -f "${setupVars}" ]]; then
err "::: Missing setup vars file!"
exit 1