Browse Source

Implement a validation function to verify the correct version number.

Raphael Schneeberger 5 years ago
parent
commit
3596187ef2
2 changed files with 10 additions and 0 deletions
  1. 1 0
      CHANGELOG.md
  2. 9 0
      src/deb/hestia/preinst

+ 1 - 0
CHANGELOG.md

@@ -27,6 +27,7 @@ All notable changes to this project will be documented in this file.
 - Fixed ssh config save bug when edit the over interface.
 - Fixed different permission issues on user restore.
 - Stop trying to renew LE certs after multiple consecutive failed attempts. Thanks @dpeca
+- Implement a validation function to verify the correct version in hestia.conf prior to install a new one.
 
 ## [1.1.1] - 2020-03-24 - Hotfix
 ### Features

+ 9 - 0
src/deb/hestia/preinst

@@ -5,8 +5,17 @@ if [ ! -e "/usr/local/hestia/data/users/admin" ]; then
     exit
 fi
 
+# Load hestia.conf
+source /usr/local/hestia/conf/hestia.conf
+
 # Configure apt to retry downloading on error
 if [ ! -f /etc/apt/apt.conf.d/80-retries ]; then
     echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries
 fi
 
+# Validate version number and replace if different
+HESTIA_V=$(dpkg -s hestia | grep -i version | awk '{ print $2 }')
+
+if [ ! "$HESTIA_V" = "$VERSION" ]; then
+    sed -i "s/VERSION=.*/VERSION='$HESTIA_V'/g" /usr/local/hestia/conf/hestia.conf
+fi