mirror of
https://github.com/pivpn/pivpn.git
synced 2025-04-22 15:20:11 +00:00
fix(installer): fix some code style errors
Fix some code style error about the pipelines
This commit is contained in:
parent
699f72712d
commit
e09f3a04bd
14 changed files with 316 additions and 309 deletions
|
@ -49,8 +49,8 @@ listClients() {
|
|||
BYTES_RECEIVED="$(awk '{ print $6 }' <<< "${LINE}")"
|
||||
BYTES_SENT="$(awk '{ print $7 }' <<< "${LINE}")"
|
||||
LAST_SEEN="$(awk '{ print $5 }' <<< "${LINE}")"
|
||||
CLIENT_NAME="$(grep "${PUBLIC_KEY}" "${CLIENTS_FILE}" |
|
||||
awk '{ print $1 }')"
|
||||
CLIENT_NAME="$(grep "${PUBLIC_KEY}" "${CLIENTS_FILE}" \
|
||||
| awk '{ print $1 }')"
|
||||
printf "%s \t %s \t %s \t " \
|
||||
"${CLIENT_NAME}" \
|
||||
"${REMOTE_IP}" \
|
||||
|
|
|
@ -40,9 +40,9 @@ while [[ "$#" -gt 0 ]]; do
|
|||
_val="${_key##--name=}"
|
||||
|
||||
if [[ "${_val}" == "${_key}" ]]; then
|
||||
[[ "$#" -lt 2 ]] &&
|
||||
err "::: Missing value for the optional argument '${_key}'." &&
|
||||
exit 1
|
||||
[[ "$#" -lt 2 ]] \
|
||||
&& err "::: Missing value for the optional argument '${_key}'." \
|
||||
&& exit 1
|
||||
|
||||
_val="${2}"
|
||||
shift
|
||||
|
@ -94,9 +94,9 @@ elif [[ -f "configs/${CLIENT_NAME}.conf" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
wg genkey |
|
||||
tee "keys/${CLIENT_NAME}_priv" |
|
||||
wg pubkey > "keys/${CLIENT_NAME}_pub"
|
||||
wg genkey \
|
||||
| tee "keys/${CLIENT_NAME}_priv" \
|
||||
| wg pubkey > "keys/${CLIENT_NAME}_pub"
|
||||
wg genpsk | tee "keys/${CLIENT_NAME}_psk" &> /dev/null
|
||||
echo "::: Client Keys generated"
|
||||
|
||||
|
@ -104,8 +104,8 @@ echo "::: Client Keys generated"
|
|||
for i in {2..254}; do
|
||||
if ! grep -q " ${i}$" configs/clients.txt; then
|
||||
COUNT="${i}"
|
||||
echo "${CLIENT_NAME} $(< keys/"${CLIENT_NAME}"_pub) $(date +%s) ${COUNT}" |
|
||||
tee -a configs/clients.txt > /dev/null
|
||||
echo "${CLIENT_NAME} $(< keys/"${CLIENT_NAME}"_pub) $(date +%s) ${COUNT}" \
|
||||
| tee -a configs/clients.txt > /dev/null
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
@ -167,12 +167,12 @@ echo "::: Client config generated"
|
|||
echo "::: Updated server config"
|
||||
|
||||
if [[ -f /etc/pivpn/hosts.wireguard ]]; then
|
||||
echo "${NET_REDUCED}.${COUNT} ${CLIENT_NAME}.pivpn" |
|
||||
tee -a /etc/pivpn/hosts.wireguard > /dev/null
|
||||
echo "${NET_REDUCED}.${COUNT} ${CLIENT_NAME}.pivpn" \
|
||||
| tee -a /etc/pivpn/hosts.wireguard > /dev/null
|
||||
|
||||
if [[ "${pivpnenableipv6}" == 1 ]]; then
|
||||
echo "${pivpnNETv6}${COUNT} ${CLIENT_NAME}.pivpn" |
|
||||
tee -a /etc/pivpn/hosts.wireguard > /dev/null
|
||||
echo "${pivpnNETv6}${COUNT} ${CLIENT_NAME}.pivpn" \
|
||||
| tee -a /etc/pivpn/hosts.wireguard > /dev/null
|
||||
fi
|
||||
|
||||
if killall -SIGHUP pihole-FTL; then
|
||||
|
|
|
@ -100,11 +100,11 @@ for CLIENT_NAME in "${CLIENTS_TO_REMOVE[@]}"; do
|
|||
# Grab the least significant octed of the client IP address
|
||||
COUNT="$(grep "^${CLIENT_NAME} " configs/clients.txt | awk '{print $4}')"
|
||||
# The creation date of the client
|
||||
CREATION_DATE="$(grep "^${CLIENT_NAME} " configs/clients.txt |
|
||||
awk '{print $3}')"
|
||||
CREATION_DATE="$(grep "^${CLIENT_NAME} " configs/clients.txt \
|
||||
| awk '{print $3}')"
|
||||
# And its public key
|
||||
PUBLIC_KEY="$(grep "^${CLIENT_NAME} " configs/clients.txt |
|
||||
awk '{print $2}')"
|
||||
PUBLIC_KEY="$(grep "^${CLIENT_NAME} " configs/clients.txt \
|
||||
| awk '{print $2}')"
|
||||
|
||||
# Then remove the client matching the variables above
|
||||
sed \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue