From adf23703ff4a57ecb57c30738e95798923442786 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 22 Apr 2020 12:09:06 +0200 Subject: [PATCH] Finishing bin/start-openfortivpn so far ... --- bin/start-openfortivpn | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bin/start-openfortivpn b/bin/start-openfortivpn index 4df1dd6..7743d91 100755 --- a/bin/start-openfortivpn +++ b/bin/start-openfortivpn @@ -131,6 +131,29 @@ check_preferences() { fi } +#------------------------------------------------------------------------------ +restore_normal_conf() { + + info "Restoring normal ${CYAN}/etc/resolv.conf${NORMAL} by ${CYAN}${RESOLV_CONF_NON_DPX}${NORMAL} ..." + + CP -p "${RESOLV_CONF_NON_DPX}" /etc/resolv.conf + +} + +#------------------------------------------------------------------------------ +start_vpn() { + + trap restore_normal_conf INT TERM EXIT ABRT + + info "Enabling special ${CYAN}/etc/resolv.conf${NORMAL} by ${CYAN}${RESOLV_CONF_DPX}${NORMAL} ..." + CP -p "${RESOLV_CONF_DPX}" /etc/resolv.conf + + local cmd="openfortivpn --no-dns --pppd-no-peerdns" + debug "Executing: ${cmd}" + eval ${cmd} + +} + #------------------------------------------------------------------------------ main() { @@ -138,6 +161,7 @@ main() { umask 0022 check_preferences + start_vpn } main "$@" -- 2.39.5