updated on Fri Jan 13 20:02:10 UTC 2012
[aur-mirror.git] / agnclient / agncli
blobd86a9dffcdb89392d81f8c28cbf656c7b4aeef3e
1 #!/bin/bash
3 # agnclient CLI version
4 # This is more or less a re-write of NetVPN.sh to be more multi-user
5 # friendly, and more debian-like with the way it discovers things.
7 # David Zanetti <dzanetti@nz1.ibm.com> 20080115
9 . /etc/default/agnclient
11 if [ -z "${SMX_ADDRESS}" ]; then
12 echo "Please define SMX_ADDRESS in /etc/default/agnclient"
13 exit 1;
16 if [ -f ~/.agncli ]; then
17 . ~/.agncli
20 if [ -z "${NETVPN_ACCOUNT}" ] || [ -z "${NETVPN_USERNAME}" ] \
21 || [ -z "${NETVPN_PASSWORD}" ]; then
22 echo "Please define NETVPN_ACCOUNT, NETVPN_USERNAME, and NETVPN_PASSWORD in"
23 echo "either /etc/default/agnclient or ~/.agncli"
24 exit 1;
27 VPNCLIENT=/opt/agns/bin/vpnCLI
29 if [ ! -x ${VPNCLIENT} ]; then
30 echo "Cannot execute VPN client binaries, broken packages?"
31 exit 1;
34 # Work out proxy args
35 if [ -n "${HTTP_PROXY}" ]; then
36 if [ -n "${HTTP_PROXY_AUTH}" ]; then
37 $PROXY="${HTTP_PROXY} ${HTTP_PROXY_AUTH}"
38 else
39 $PROXY="${HTTP_PROXY}"
43 # export various things into the environment
44 export NETVPN_ACCOUNT NETVPN_USERNAME NETVPN_PASSWORD
46 echo "Using ${NETVPN_ACCOUNT}/${NETVPN_USERNAME} login"
48 # Actually invoke client
49 exec ${VPNCLIENT} ${SMX_ADDRESS} ${PROXY}