From: Michael Gebetsroither Date: Sat, 19 Nov 2005 10:55:03 +0000 (+0100) Subject: added -f FORCE option, to override the do not touch in configs X-Git-Tag: 0.68 X-Git-Url: http://git.grml.org/?a=commitdiff_plain;h=53da7a5d93d79aef5d56c3924384f83f43232c7c;hp=a1989990540702f98cc5ab7f1fc693fea2d74a0f;p=grml-terminalserver.git added -f FORCE option, to override the do not touch in configs --- 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 ;;