Explorar o código

Merge branch 'fix/sort-hestia-conf' into main

Kristan Kenney %!s(int64=5) %!d(string=hai) anos
pai
achega
7ce68138f2
Modificáronse 3 ficheiros con 42 adicións e 0 borrados
  1. 6 0
      bin/v-change-sys-config-value
  2. 18 0
      install/hst-install-debian.sh
  3. 18 0
      install/hst-install-ubuntu.sh

+ 6 - 0
bin/v-change-sys-config-value

@@ -48,6 +48,12 @@ else
     sed -i "s|$key=.*|$key='$value'|g" $HESTIA/conf/hestia.conf
 fi
 
+# Sort configuration file in alphabetical order on change
+sort $HESTIA/conf/hestia.conf -o /tmp/updconf
+mv $HESTIA/conf/hestia.conf $HESTIA/conf/hestia.conf.bak
+mv /tmp/updconf $HESTIA/conf/hestia.conf
+rm -f $HESTIA/conf/hestia.conf.bak
+
 #----------------------------------------------------------#
 #                       Hestia                             #
 #----------------------------------------------------------#

+ 18 - 0
install/hst-install-debian.sh

@@ -156,6 +156,20 @@ write_config_value() {
     echo "$key='$value'" >> $HESTIA/conf/hestia.conf
 }
 
+# Sort configuration file values
+# Write final copy to $HESTIA/conf/hestia.conf for active usage
+# Duplicate file to $HESTIA/conf/defaults/hestia.conf to restore known good installation values
+sort_config_file(){
+    sort $HESTIA/conf/hestia.conf -o /tmp/updconf
+    mv $HESTIA/conf/hestia.conf $HESTIA/conf/hestia.conf.bak
+    mv /tmp/updconf $HESTIA/conf/hestia.conf
+    rm -f $HESTIA/conf/hestia.conf.bak
+    if [ ! -d "$HESTIA/conf/defaults/" ]; then
+        mkdir -p "$HESTIA/conf/defaults/"
+    fi
+    cp $HESTIA/conf/hestia.conf $HESTIA/conf/defaults/hestia.conf
+}
+
 #----------------------------------------------------------#
 #                    Verifications                         #
 #----------------------------------------------------------#
@@ -1875,4 +1889,8 @@ if [ "$interactive" = 'yes' ]; then
     fi
 fi
 
+# Clean-up
+# Sort final configuration file
+sort_config_file
+
 # EOF

+ 18 - 0
install/hst-install-ubuntu.sh

@@ -137,6 +137,20 @@ write_config_value() {
     echo "$key='$value'" >> $HESTIA/conf/hestia.conf
 }
 
+# Sort configuration file values
+# Write final copy to $HESTIA/conf/hestia.conf for active usage
+# Duplicate file to $HESTIA/conf/defaults/hestia.conf to restore known good installation values
+sort_config_file(){
+    sort $HESTIA/conf/hestia.conf -o /tmp/updconf
+    mv $HESTIA/conf/hestia.conf $HESTIA/conf/hestia.conf.bak
+    mv /tmp/updconf $HESTIA/conf/hestia.conf
+    rm -f $HESTIA/conf/hestia.conf.bak
+    if [ ! -d "$HESTIA/conf/defaults/" ]; then
+        mkdir -p "$HESTIA/conf/defaults/"
+    fi
+    cp $HESTIA/conf/hestia.conf $HESTIA/conf/defaults/hestia.conf
+}
+
 #----------------------------------------------------------#
 #                    Verifications                         #
 #----------------------------------------------------------#
@@ -1909,4 +1923,8 @@ if [ "$interactive" = 'yes' ]; then
     fi
 fi
 
+# Clean-up
+# Sort final configuration file
+sort_config_file
+
 # EOF