Merge pull request #22 from DyonR/dev

Added quotes around some ${VPN_CONFIG}'s, closes #21
This commit is contained in:
DyonR 2020-11-08 23:17:17 +01:00 committed by GitHub
commit b74278a838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,13 +99,13 @@ if [[ $VPN_ENABLED == "yes" ]]; then
echo "${VPN_PASSWORD}" >> /config/openvpn/credentials.conf
# Replace line with one that points to credentials.conf
auth_cred_exist=$(cat ${VPN_CONFIG} | grep -m 1 'auth-user-pass')
auth_cred_exist=$(cat "${VPN_CONFIG}" | grep -m 1 'auth-user-pass')
if [[ ! -z "${auth_cred_exist}" ]]; then
# Get line number of auth-user-pass
LINE_NUM=$(grep -Fn -m 1 'auth-user-pass' ${VPN_CONFIG} | cut -d: -f 1)
sed -i "${LINE_NUM}s/.*/auth-user-pass credentials.conf/" ${VPN_CONFIG}
LINE_NUM=$(grep -Fn -m 1 'auth-user-pass' "${VPN_CONFIG}" | cut -d: -f 1)
sed -i "${LINE_NUM}s/.*/auth-user-pass credentials.conf/" "${VPN_CONFIG}"
else
sed -i "1s/.*/auth-user-pass credentials.conf/" ${VPN_CONFIG}
sed -i "1s/.*/auth-user-pass credentials.conf/" "${VPN_CONFIG}"
fi
fi
fi
@ -259,7 +259,7 @@ if [[ $VPN_ENABLED == "yes" ]]; then
if [[ "${VPN_TYPE}" == "openvpn" ]]; then
echo "[INFO] Starting OpenVPN..." | ts '%Y-%m-%d %H:%M:%.S'
cd /config/openvpn
exec openvpn --config ${VPN_CONFIG} &
exec openvpn --config "${VPN_CONFIG}" &
#exec /bin/bash /etc/openvpn/openvpn.init start &
else
echo "[INFO] Starting WireGuard..." | ts '%Y-%m-%d %H:%M:%.S'