mirror of
https://github.com/pivpn/pivpn.git
synced 2025-04-26 09:10:10 +00:00
Shellcheck compliance
scripts/wireguard/makeCONF.sh * SC1090: ShellCheck can't follow non-constant source. Use a directive to specify location. * Disabled warning * SC2154: <VariableName> is referenced but not assigned. * Disabled warning * SC2086: Double quote to prevent globbing and word splitting. * Added double quotes
This commit is contained in:
parent
2a78fce9d3
commit
f823b2bd4c
1 changed files with 9 additions and 1 deletions
|
@ -7,6 +7,7 @@ if [ ! -f "${setupVars}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "${setupVars}"
|
source "${setupVars}"
|
||||||
|
|
||||||
helpFunc(){
|
helpFunc(){
|
||||||
|
@ -46,6 +47,8 @@ while test $# -gt 0; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Disabling SC2154, variables sourced externaly
|
||||||
|
# shellcheck disable=SC2154
|
||||||
# The home folder variable was sourced from the settings file.
|
# The home folder variable was sourced from the settings file.
|
||||||
if [ ! -d "${install_home}/configs" ]; then
|
if [ ! -d "${install_home}/configs" ]; then
|
||||||
mkdir "${install_home}/configs"
|
mkdir "${install_home}/configs"
|
||||||
|
@ -92,17 +95,21 @@ echo "::: Client Keys generated"
|
||||||
for i in {2..254}; do
|
for i in {2..254}; do
|
||||||
if ! grep -q " $i$" configs/clients.txt; then
|
if ! grep -q " $i$" configs/clients.txt; then
|
||||||
COUNT="$i"
|
COUNT="$i"
|
||||||
echo "${CLIENT_NAME} $(<keys/${CLIENT_NAME}_pub) $(date +%s) ${COUNT}" >> configs/clients.txt
|
echo "${CLIENT_NAME} $(<keys/"${CLIENT_NAME}"_pub) $(date +%s) ${COUNT}" >> configs/clients.txt
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Disabling SC2154, variables sourced externaly
|
||||||
|
# shellcheck disable=SC2154
|
||||||
NET_REDUCED="${pivpnNET::-2}"
|
NET_REDUCED="${pivpnNET::-2}"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
echo "[Interface]
|
echo "[Interface]
|
||||||
PrivateKey = $(cat "keys/${CLIENT_NAME}_priv")
|
PrivateKey = $(cat "keys/${CLIENT_NAME}_priv")
|
||||||
Address = ${NET_REDUCED}.${COUNT}/${subnetClass}" > "configs/${CLIENT_NAME}.conf"
|
Address = ${NET_REDUCED}.${COUNT}/${subnetClass}" > "configs/${CLIENT_NAME}.conf"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
echo -n "DNS = ${pivpnDNS1}" >> "configs/${CLIENT_NAME}.conf"
|
echo -n "DNS = ${pivpnDNS1}" >> "configs/${CLIENT_NAME}.conf"
|
||||||
if [ -n "${pivpnDNS2}" ]; then
|
if [ -n "${pivpnDNS2}" ]; then
|
||||||
echo ", ${pivpnDNS2}" >> "configs/${CLIENT_NAME}.conf"
|
echo ", ${pivpnDNS2}" >> "configs/${CLIENT_NAME}.conf"
|
||||||
|
@ -111,6 +118,7 @@ else
|
||||||
fi
|
fi
|
||||||
echo >> "configs/${CLIENT_NAME}.conf"
|
echo >> "configs/${CLIENT_NAME}.conf"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
echo "[Peer]
|
echo "[Peer]
|
||||||
PublicKey = $(cat keys/server_pub)
|
PublicKey = $(cat keys/server_pub)
|
||||||
PresharedKey = $(cat "keys/${CLIENT_NAME}_psk")
|
PresharedKey = $(cat "keys/${CLIENT_NAME}_psk")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue