allow specifying extra config

This commit is contained in:
Nate Jones 2016-05-16 09:56:27 -07:00
parent df63db02a0
commit 191cb45106

View File

@ -52,6 +52,7 @@ usage() {
echo " -z Enable comp-lzo compression." echo " -z Enable comp-lzo compression."
echo " -2 Enable two factor authentication using Google Authenticator." echo " -2 Enable two factor authentication using Google Authenticator."
echo " -f Set the fragment directive." echo " -f Set the fragment directive."
echo " -e Add extra server config"
} }
if [ "$DEBUG" == "1" ]; then if [ "$DEBUG" == "1" ]; then
@ -76,16 +77,20 @@ TMP_DNS_SERVERS=()
OVPN_TLS_CIPHER='' OVPN_TLS_CIPHER=''
OVPN_CIPHER='' OVPN_CIPHER=''
OVPN_AUTH='' OVPN_AUTH=''
OVPN_EXTRA_CONFIG=''
# Import defaults if present # Import defaults if present
[ -r "$OVPN_ENV" ] && source "$OVPN_ENV" [ -r "$OVPN_ENV" ] && source "$OVPN_ENV"
# Parse arguments # Parse arguments
while getopts ":a:C:T:r:s:du:cp:n:DNmf:tz2" opt; do while getopts ":a:e:C:T:r:s:du:cp:n:DNmf:tz2" opt; do
case $opt in case $opt in
a) a)
OVPN_AUTH="$OPTARG" OVPN_AUTH="$OPTARG"
;; ;;
e)
OVPN_EXTRA_CONFIG="$OPTARG"
;;
C) C)
OVPN_CIPHER="$OPTARG" OVPN_CIPHER="$OPTARG"
;; ;;
@ -230,6 +235,8 @@ EOF
[ -n "$OVPN_FRAGMENT" ] && echo "fragment $OVPN_FRAGMENT" >> "$conf" [ -n "$OVPN_FRAGMENT" ] && echo "fragment $OVPN_FRAGMENT" >> "$conf"
[ -n "$OVPN_EXTRA_CONFIG" ] && echo "$OVPN_EXTRA_CONFIG" >> "$conf"
[ "$OVPN_DNS" == "1" ] && for i in "${OVPN_DNS_SERVERS[@]}"; do [ "$OVPN_DNS" == "1" ] && for i in "${OVPN_DNS_SERVERS[@]}"; do
echo "push dhcp-option DNS $i" >> "$conf" echo "push dhcp-option DNS $i" >> "$conf"
done done