Skip to content

Commit

Permalink
openvpn.sh move variables to more visible location
Browse files Browse the repository at this point in the history
  • Loading branch information
David Personette committed Sep 5, 2017
1 parent 8217971 commit df3f755
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions openvpn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@

set -o nounset # Treat unset variables as an error

dir="/vpn"
auth="$dir/vpn.cert_auth"
conf="$dir/vpn.conf"
cert="$dir/vpn-ca.crt"
file="$dir/.firewall"
[[ -f $conf ]] || { [[ $(ls $dir/*|egrep '\.(conf|ovpn)$' 2>&-|wc -w) -eq 1 ]]&&
conf=$(ls $dir/* | egrep '\.(conf|ovpn)$' 2>&-); }
[[ -f $cert ]] || { [[ $(ls $dir/* | egrep '\.ce?rt$' 2>&- | wc -w) -eq 1 ]] &&
cert=$(ls $dir/* | egrep '\.ce?rt$' 2>&-); }

### cert_auth: setup auth passwd for accessing certificate
# Arguments:
# passwd) Password to access the cert
Expand Down Expand Up @@ -192,6 +182,16 @@ The 'command' (if provided and valid) will be run instead of openvpn
exit $RC
}

dir="/vpn"
auth="$dir/vpn.cert_auth"
conf="$dir/vpn.conf"
cert="$dir/vpn-ca.crt"
file="$dir/.firewall"
[[ -f $conf ]] || { [[ $(ls $dir/*|egrep '\.(conf|ovpn)$' 2>&-|wc -w) -eq 1 ]]&&
conf=$(ls $dir/* | egrep '\.(conf|ovpn)$' 2>&-); }
[[ -f $cert ]] || { [[ $(ls $dir/* | egrep '\.ce?rt$' 2>&- | wc -w) -eq 1 ]] &&
cert=$(ls $dir/* | egrep '\.ce?rt$' 2>&-); }

while getopts ":hc:df:p:r:t:v:" opt; do
case "$opt" in
h) usage ;;
Expand Down

0 comments on commit df3f755

Please sign in to comment.