Skip to content

Commit c83c523

Browse files
author
Kristan Kenney
committed
Add v-restore-sys-config
1 parent 9bf85c8 commit c83c523

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

bin/v-restore-sys-config

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# info: Restore system configuration
3+
# options: [SYSTEM]
4+
# labels:
5+
#
6+
# example: v-restore-sys-config
7+
#
8+
# The function restores system configuration file
9+
10+
system=$1
11+
12+
# Includes
13+
# shellcheck source=/usr/local/hestia/func/main.sh
14+
source $HESTIA/func/main.sh
15+
# shellcheck source=/usr/local/hestia/func/syshealth.sh
16+
source $HESTIA/func/syshealth.sh
17+
18+
#----------------------------------------------------------#
19+
# Action #
20+
#----------------------------------------------------------#
21+
22+
syshealth_restore_system_installed_config
23+
24+
#----------------------------------------------------------#
25+
# Hestia #
26+
#----------------------------------------------------------#
27+
log_event "$OK" "$ARGUMENTS"

func/syshealth.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ function syshealth_repair_web_config() {
147147
done
148148
}
149149

150+
function syshealth_restore_system_installed_defaults() {
151+
if [ -f "$HESTIA/conf/defaults/hestia.conf" ]; then
152+
mv $HESTIA/conf/hestia.conf $HESTIA/conf/hestia.conf.old
153+
cp $HESTIA/conf/defaults/hestia.conf $HESTIA/conf/hestia.conf
154+
else
155+
echo "ERROR: System default configuration file not found, aborting."
156+
exit 1
157+
fi
158+
}
159+
150160
# Repair System Configuration
151161
# Adds missing variables to $HESTIA/conf/hestia.conf with safe default values
152162
function syshealth_repair_system_config() {
@@ -182,8 +192,8 @@ function syshealth_repair_system_config() {
182192

183193
# Backup compression level
184194
if [ -z "$BACKUP_GZIP" ]; then
185-
echo "[ ! ] Adding missing variable to hestia.conf: BACKUP_GZIP ('9')"
186-
$BIN/v-change-sys-config-value 'BACKUP_GZIP' '9'
195+
echo "[ ! ] Adding missing variable to hestia.conf: BACKUP_GZIP ('4')"
196+
$BIN/v-change-sys-config-value 'BACKUP_GZIP' '4'
187197
fi
188198

189199
# Theme

0 commit comments

Comments
 (0)