### __VARIABLES
###
+FORCE_='false'
verbose_=0
# this file holds all variable definitions
OPTIONS:
-v verbose (show what is going on, v++)
-h this help text
+ -f Force
EOT
}
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
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
}
### __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 ;;