From 53da7a5d93d79aef5d56c3924384f83f43232c7c Mon Sep 17 00:00:00 2001 From: Michael Gebetsroither Date: Sat, 19 Nov 2005 11:55:03 +0100 Subject: [PATCH 1/1] added -f FORCE option, to override the do not touch in configs --- debian/changelog | 3 ++- grml-terminalserver | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index e738bd4..795501a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,9 @@ grml-terminalserver (0.68) unstable; urgency=low * implemented a "do not touch" for dhcp config (if user removes the line, grml-terminalserver won't touch this configfile anymore). * added config action to grml-terminalserver to update configs. + * implemented force option (-f) - -- Michael Gebetsroither Sat, 19 Nov 2005 11:26:01 +0100 + -- Michael Gebetsroither Sat, 19 Nov 2005 11:50:46 +0100 grml-terminalserver (0.67) unstable; urgency=low diff --git a/grml-terminalserver b/grml-terminalserver index 61c4461..663926a 100755 --- a/grml-terminalserver +++ b/grml-terminalserver @@ -20,6 +20,7 @@ ### __VARIABLES ### +FORCE_='false' verbose_=0 # this file holds all variable definitions @@ -57,6 +58,7 @@ SERVICES: OPTIONS: -v verbose (show what is going on, v++) -h this help text + -f Force EOT } @@ -75,7 +77,12 @@ function createDhcpConf execute "mv -fb \"$DHCPD_CONFIG_FILE_\" \"$DHCPD_CONFIG_FILE_.old\"" eprint &>/dev/null execute "source $TEMPLATE_CONFIG_DIR_/dhcpd_config" die else - warn "Not updating user edited configfile $DHCPD_CONFIG_FILE_" + if [[ $FORCE_ == "true" ]]; then + execute "mv -fb \"$DHCPD_CONFIG_FILE_\" \"$DHCPD_CONFIG_FILE_.old\"" eprint &>/dev/null + execute "source $TEMPLATE_CONFIG_DIR_/dhcpd_config" die + else + warn "Not updating user edited configfile $DHCPD_CONFIG_FILE_, user -f to override" + fi fi else execute "source $TEMPLATE_CONFIG_DIR_/dhcpd_config" die @@ -88,7 +95,11 @@ function removeDhcpConf if grep $CONFIG_PATTERN_ $DHCPD_CONFIG_FILE_ &>/dev/null; then rm -f "$DHCPD_CONFIG_FILE_" else - warn "Not deleting user edited configfile $DHCPD_CONFIG_FILE_" + if [[ $FORCE_ == "true" ]]; then + rm -f "$DHCPD_CONFIG_FILE_" + else + warn "Not deleting user edited configfile $DHCPD_CONFIG_FILE_, user -f to override" + fi fi fi } @@ -284,8 +295,9 @@ function serviceStop ### __MAIN ### -while getopts "i:hv" opt; do +while getopts "fi:hv" opt; do case "$opt" in + f) FORCE_='true' ;; h) printUsage; exit ;; v) let verbose_=$verbose_+1 ;; ?) printUsage; exit 64 ;; -- 2.1.4