40 lines
599 B
Text
40 lines
599 B
Text
|
#!/bin/bash
|
||
|
# SPDX-License-Identifier: Apache-2.0
|
||
|
# Copyright (C) 2023-present Fewtarius
|
||
|
|
||
|
. /etc/profile
|
||
|
|
||
|
CFG_PATH="/storage/.config/system/configs"
|
||
|
|
||
|
backup() {
|
||
|
TYPE=$(grep a ${CFG_PATH}/system.cfg 2>&1)
|
||
|
if [[ ! "${TYPE}" =~ binary ]]
|
||
|
then
|
||
|
cp ${CFG_PATH}/system.cfg ${CFG_PATH}/system.cfg.backup
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
restore() {
|
||
|
cp ${CFG_PATH}/system.cfg.backup ${CFG_PATH}/system.cfg
|
||
|
}
|
||
|
|
||
|
verify() {
|
||
|
TYPE=$(grep a ${CFG_PATH}/system.cfg 2>&1)
|
||
|
if [[ "${TYPE}" =~ binary ]]
|
||
|
then
|
||
|
restore
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
case ${1} in
|
||
|
verify)
|
||
|
verify
|
||
|
;;
|
||
|
backup)
|
||
|
backup
|
||
|
;;
|
||
|
restore)
|
||
|
restore
|
||
|
;;
|
||
|
esac
|