LIB_DIR="${BASE_DIR}/lib"
CONF_DIR="${BASE_DIR}/etc"
DNS_DIR="${BASE_DIR}/dns"
+OFVPN_CONFIG="/etc/openfortivpn/config"
if [[ -f "${LIB_DIR}/functions.rc" ]] ; then
. "${LIB_DIR}/functions.rc"
local rfile=
local file_ok="y"
local sample_file=
+ local gateway_ip=
debug "Checking for openfortivpn ..."
if type -p openfortivpn >/dev/null ; then
error "Did not found openfortivpn. Maybe not installed?"
fi
+ if [[ ! -f "${OFVPN_CONFIG}" ]] ; then
+ error "Config file '${RED}${OFVPN_CONFIG}${NORMAL}' not found."
+ all_ok="n"
+ else
+ gateway_ip=$( cat "${OFVPN_CONFIG}" | \
+ grep -i '^[ ]*host[ ]*=' | \
+ awk -F= '{print $2}' | \
+ sed -e 's/^[ ]*//' -e 's/[ ]*$//' )
+ if [[ -z "${gateway_ip}" ]] ; then
+ error "Did not found Gateway IP address in '${RED}${OFVPN_CONFIG}${NORMAL}'."
+ all_ok="n"
+ else
+ echo "Checking Gateway IP '${GREEN}${gateway_ip}${NORMAL}' ..."
+ if ping -q -c 2 -w 2 "${gateway_ip}" ; then
+ debug "Gateway IP '${CYAN}${gateway_ip}${NORMAL}' is okay."
+ else
+ error "Could not ping '${RED}${gateway_ip}${NORMAL}'."
+ all_ok="n"
+ fi
+ fi
+ fi
+
for rfile in "${RESOLV_CONF_DPX}" "${RESOLV_CONF_NON_DPX}" ; do
debug "Checking '${CYAN}${rfile}${NORMAL}' ..."
file_ok="y"
CYAN=""
NORMAL=""
-VERSION="0.3.7"
+VERSION="0.3.8"
STD_SHORT_OPTIONS="sdvhV"
STD_LONG_OPTIONS="simulate,debug,verbose,nocolor,help,version"