mirror of
https://github.com/deajan/obackup.git
synced 2024-11-15 04:03:41 +01:00
Minor fixes in upgrade script
This commit is contained in:
parent
f4b7ef280b
commit
da91b4353b
@ -7,7 +7,7 @@ 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_REVISION=2.1
|
CONFIG_FILE_REVISION=2.1
|
||||||
PROGRAM_BUILD=2019052105
|
PROGRAM_BUILD=2019070501
|
||||||
|
|
||||||
if ! type "$BASH" > /dev/null; then
|
if ! type "$BASH" > /dev/null; then
|
||||||
echo "Please run this script only with bash shell. Tested on bash >= 3.2"
|
echo "Please run this script only with bash shell. Tested on bash >= 3.2"
|
||||||
@ -331,13 +331,13 @@ function AddMissingConfigOptions {
|
|||||||
echo "Added missing ${KEYWORDS[$counter]} config option with default option [${VALUES[$counter]}]"
|
echo "Added missing ${KEYWORDS[$counter]} config option with default option [${VALUES[$counter]}]"
|
||||||
else
|
else
|
||||||
# Not the most elegant but the quickest way :)
|
# 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"
|
sed -i'.tmp' 's/^'${KEYWORDS[$counter]}'=.*/'${KEYWORDS[$counter]}'=true/g' "$config_file"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Cannot rewrite ${[KEYWORDS[$counter]} boolean to true."
|
echo "Cannot rewrite ${[KEYWORDS[$counter]} boolean to true."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
sed -i'.tmp' 's/^'${KEYWORDS[$counter]}'=.*/'${KEYWORDS[$counter]}'=false/g' "$config_file"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Cannot rewrite ${[KEYWORDS[$counter]} boolean to false."
|
echo "Cannot rewrite ${[KEYWORDS[$counter]} boolean to false."
|
||||||
@ -376,7 +376,6 @@ function UpdateConfigHeader {
|
|||||||
fi
|
fi
|
||||||
# "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' 's/.*onfig file rev.*//' "$config_file"
|
#sed -i'.tmp' 's/.*onfig file rev.*//' "$config_file"
|
||||||
rm -f "$config_file.tmp"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -391,6 +390,7 @@ if [ "$1" != "" ] && [ -f "$1" ] && [ -w "$1" ]; then
|
|||||||
RewriteOldConfigFiles "$CONF_FILE"
|
RewriteOldConfigFiles "$CONF_FILE"
|
||||||
AddMissingConfigOptions "$CONF_FILE"
|
AddMissingConfigOptions "$CONF_FILE"
|
||||||
UpdateConfigHeader "$CONF_FILE"
|
UpdateConfigHeader "$CONF_FILE"
|
||||||
|
rm -f "$CONF_FILE.tmp"
|
||||||
else
|
else
|
||||||
Usage
|
Usage
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user