From: Frank Brehm Date: Wed, 22 Apr 2020 10:09:06 +0000 (+0200) Subject: Finishing bin/start-openfortivpn so far ... X-Git-Tag: 0.1.2~5^2~1 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=adf23703ff4a57ecb57c30738e95798923442786;p=pixelpark%2Fadmin-tools.git Finishing bin/start-openfortivpn so far ... --- 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 "$@"