1
0
mirror of https://github.com/deajan/obackup.git synced 2024-12-26 15:33:41 +01:00

Minor improvement

This commit is contained in:
deajan 2016-10-17 17:42:13 +02:00
parent 7f5126ad28
commit 4982d326d3

View File

@ -6,6 +6,7 @@ AUTHOR="(C) 2016 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/obacup - ozy@netpower.fr" CONTACT="http://www.netpower.fr/obacup - ozy@netpower.fr"
OLD_PROGRAM_VERSION="v1.x" OLD_PROGRAM_VERSION="v1.x"
NEW_PROGRAM_VERSION="v2.1x" NEW_PROGRAM_VERSION="v2.1x"
CONFIG_FILE_VERSION=2016091402
PROGRAM_BUILD=2016091402 PROGRAM_BUILD=2016091402
if ! type "$BASH" > /dev/null; then if ! type "$BASH" > /dev/null; then
@ -289,7 +290,7 @@ function AddMissingConfigOptions {
local counter=0 local counter=0
while [ $counter -lt ${#KEYWORDS[@]} ]; do while [ $counter -lt ${#KEYWORDS[@]} ]; do
if ! grep "^${KEYWORDS[$counter]}=" "$config_file"; then if ! grep "^${KEYWORDS[$counter]}=" > /dev/null "$config_file"; then
echo "${KEYWORDS[$counter]} not found" echo "${KEYWORDS[$counter]} not found"
if [ $counter -gt 0 ]; then if [ $counter -gt 0 ]; then
sed -i'.tmp' '/^'${KEYWORDS[$((counter-1))]}'=*/a\'$'\n'${KEYWORDS[$counter]}'="'"${VALUES[$counter]}"'"\'$'\n''' "$config_file" sed -i'.tmp' '/^'${KEYWORDS[$((counter-1))]}'=*/a\'$'\n'${KEYWORDS[$counter]}'="'"${VALUES[$counter]}"'"\'$'\n''' "$config_file"
@ -310,7 +311,7 @@ function UpdateConfigHeader {
local config_file="${1}" local config_file="${1}"
# "onfig file rev" to deal with earlier variants of the file # "onfig file rev" to deal with earlier variants of the file
sed -i'.tmp' '/onfig file rev/c\###### '$SUBPROGRAM' config file rev '$PROGRAM_BUILD "$config_file" sed -i'.tmp' '/onfig file rev/c\###### '$SUBPROGRAM' config file rev '$CONFIG_FILE_VERSION' '$NEW_PROGRAM_VERSION "$config_file"
rm -f "$config_file.tmp" rm -f "$config_file.tmp"
} }