From 80f3b2f0bcabe2faa5fa38ce00c350da9583d676 Mon Sep 17 00:00:00 2001 From: deajan Date: Fri, 5 Jul 2019 23:26:50 +0200 Subject: [PATCH] Minor fixes in upgrade script --- upgrade-v1.0x-v1.3x.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upgrade-v1.0x-v1.3x.sh b/upgrade-v1.0x-v1.3x.sh index 63318f6..fcad9ad 100755 --- a/upgrade-v1.0x-v1.3x.sh +++ b/upgrade-v1.0x-v1.3x.sh @@ -7,7 +7,7 @@ CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" OLD_PROGRAM_VERSION="v1.0x-v1.2x" NEW_PROGRAM_VERSION="v1.3x" CONFIG_FILE_REVISION=1.3.0 -PROGRAM_BUILD=2019070501 +PROGRAM_BUILD=2019070502 ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode if ! type "$BASH" > /dev/null; then @@ -522,13 +522,13 @@ function AddMissingConfigOptionsAndFixBooleans { echo "Added missing ${KEYWORDS[$counter]} config option with default option [${VALUES[$counter]}]" else # Not the most elegant but the quickest way :) - if grep "^${KEYWORDS[$counter]}=yes" > /dev/null "$config_file"; then + if grep "^${KEYWORDS[$counter]}=yes$" > /dev/null "$config_file"; then sed -i'.tmp' 's/^'${KEYWORDS[$counter]}'=.*/'${KEYWORDS[$counter]}'=true/g' "$config_file" if [ $? -ne 0 ]; then echo "Cannot rewrite ${[KEYWORDS[$counter]} boolean to true." exit 1 fi - elif grep "^${KEYWORDS[$counter]}=no" > /dev/null "$config_file"; then + elif grep "^${KEYWORDS[$counter]}=no$" > /dev/null "$config_file"; then sed -i'.tmp' 's/^'${KEYWORDS[$counter]}'=.*/'${KEYWORDS[$counter]}'=false/g' "$config_file" if [ $? -ne 0 ]; then echo "Cannot rewrite ${[KEYWORDS[$counter]} boolean to false." @@ -565,7 +565,6 @@ function UpdateConfigHeader { fi # "onfig file rev" to deal with earlier variants of the file where c was lower or uppercase sed -i'.tmp' 's/.*onfig file rev.*//' "$config_file" - rm -f "$config_file.tmp" fi } @@ -609,6 +608,7 @@ elif [ "$1" != "" ] && [ -f "$1" ] && [ -w "$1" ]; then UpdateConfigHeader "$CONF_FILE" RenameStateFiles "$MASTER_SYNC_DIR" RenameStateFiles "$SLAVE_SYNC_DIR" + rm -f "$CONF_FILE.tmp" else Usage fi