added -f FORCE option, to override the do not touch in configs 0.68
authorMichael Gebetsroither <michael.geb@gmx.at>
Sat, 19 Nov 2005 10:55:03 +0000 (11:55 +0100)
committerMichael Gebetsroither <michael.geb@gmx.at>
Sat, 19 Nov 2005 10:55:03 +0000 (11:55 +0100)
debian/changelog
grml-terminalserver

index e738bd4..795501a 100644 (file)
@@ -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 <michael.geb@gmx.at>  Sat, 19 Nov 2005 11:26:01 +0100
+ -- Michael Gebetsroither <michael.geb@gmx.at>  Sat, 19 Nov 2005 11:50:46 +0100
 
 grml-terminalserver (0.67) unstable; urgency=low
 
index 61c4461..663926a 100755 (executable)
@@ -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 ;;