diff --git a/misc/update-version.sh b/misc/update-version.sh index b492fd530..059802c13 100755 --- a/misc/update-version.sh +++ b/misc/update-version.sh @@ -35,7 +35,7 @@ for test in tests/core/* ; do done shopt -u globstar # linux -sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" src/linux/scripts/*.sh +sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" src/linux/scripts/beforeInstall.sh # db sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" src/common/db/Database.py sed -i "s@${OLD_VERSION}@${NEW_VERSION}@g" src/common/db/model.py diff --git a/src/linux/scripts/afterRemoveDEB.sh b/src/linux/scripts/afterRemoveDEB.sh index c80fa5a09..974e44b10 100644 --- a/src/linux/scripts/afterRemoveDEB.sh +++ b/src/linux/scripts/afterRemoveDEB.sh @@ -128,14 +128,15 @@ elif [ "$1" = "purge" ]; then purge else echo "Package is being upgraded" - # Check the version of the package and if it's inferior to 1.5.6, we need to copy the variables.env file + # Check the version of the package and if it's inferior to 1.5.0, we need to copy the variables.env file VERSION=$(dpkg-query -W -f='${Version}' bunkerweb) - if [ "$VERSION" != "1.5.6" ]; then + if ! [[ "$VERSION" =~ ^1\.5 ]]; then echo "ℹ️ Copyenv variables to /var/tmp/bunkerweb/*.env" do_and_check_cmd cp -f /opt/bunkerweb/variables.env /var/tmp/variables.env do_and_check_cmd cp -f /opt/bunkerweb/ui.env /var/tmp/ui.env fi cp -f /etc/bunkerweb/variables.env /var/tmp/variables.env cp -f /etc/bunkerweb/ui.env /var/tmp/ui.env + cp -f /var/lib/bunkerweb/db.sqlite3 /var/tmp/db.sqlite3 exit 0 fi diff --git a/src/linux/scripts/afterRemoveRPM.sh b/src/linux/scripts/afterRemoveRPM.sh index e856fbc4b..51c0c5d26 100644 --- a/src/linux/scripts/afterRemoveRPM.sh +++ b/src/linux/scripts/afterRemoveRPM.sh @@ -130,9 +130,9 @@ if [ "$1" = "0" ]; then purge elif [ "$1" = "1" ]; then echo "Package is being upgraded" - # Check the version of the package and if it's inferior to 1.5.6, we need to copy the variables.env file + # Check the version of the package and if it's inferior to 1.5, we need to copy the variables.env file VERSION=$(rpm -q --queryformat '%{VERSION}' bunkerweb) - if [ "$VERSION" != "1.5.6" ]; then + if ! [[ "$VERSION" =~ ^1\.5 ]]; then echo "ℹ️ Copy /etc/bunkerweb/variables.env to /var/tmp/bunkerweb/variables.env" do_and_check_cmd cp -f /opt/bunkerweb/variables.env /var/tmp/variables.env do_and_check_cmd cp -f /opt/bunkerweb/ui.env /var/tmp/ui.env diff --git a/src/linux/scripts/beforeInstall.sh b/src/linux/scripts/beforeInstall.sh index 4a677a757..1a6ac1f24 100644 --- a/src/linux/scripts/beforeInstall.sh +++ b/src/linux/scripts/beforeInstall.sh @@ -39,6 +39,10 @@ if [ -f /etc/os-release ]; then do_and_check_cmd cp -f /var/tmp/ui.env /etc/bunkerweb/ui.env fi fi + if [ -f /var/tmp/db.sqlite3 ]; then + echo "ℹ️ Copy /var/tmp/db.sqlite3 to /var/lib/bunkerweb/db.sqlite3" + do_and_check_cmd cp -f /var/tmp/db.sqlite3 /var/lib/bunkerweb/db.sqlite3 + fi else echo "❌ Error: /etc/os-release not found" exit 1