From e3a9fe044199af1af87ba5a463992922d70bda90 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 23 Apr 2020 08:06:06 +0200 Subject: [PATCH] Adding failing function CP() --- bin/start-openfortivpn | 6 ++++++ lib/functions.rc | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bin/start-openfortivpn b/bin/start-openfortivpn index 7743d91..8ead94c 100755 --- a/bin/start-openfortivpn +++ b/bin/start-openfortivpn @@ -143,6 +143,7 @@ restore_normal_conf() { #------------------------------------------------------------------------------ start_vpn() { + debug "Activating trap ..." trap restore_normal_conf INT TERM EXIT ABRT info "Enabling special ${CYAN}/etc/resolv.conf${NORMAL} by ${CYAN}${RESOLV_CONF_DPX}${NORMAL} ..." @@ -152,6 +153,11 @@ start_vpn() { debug "Executing: ${cmd}" eval ${cmd} + debug "Deactivating trap ..." + trap - INT TERM EXIT ABRT + + restore_normal_conf + } #------------------------------------------------------------------------------ diff --git a/lib/functions.rc b/lib/functions.rc index 767201a..6673068 100644 --- a/lib/functions.rc +++ b/lib/functions.rc @@ -10,7 +10,7 @@ BLUE="" CYAN="" NORMAL="" -VERSION="0.3.0" +VERSION="0.3.1" STD_SHORT_OPTIONS="sdvhV" STD_LONG_OPTIONS="simulate,debug,verbose,nocolor,help,version" @@ -299,6 +299,21 @@ RM() { } +#------------------------------------------------------------------------------ +CP() { + + if [[ "${SIMULATE}" == "y" ]] ; then + debug "Simulated copying of: $*" + return + fi + if [[ "${VERBOSE}" != "y" ]] ; then + cp "$@" + else + cp --verbose "$@" + fi + +} + #------------------------------------------------------------------------------ set_locale() { -- 2.39.5