mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 07:07:46 +01:00
moved config validation into boostrap
This commit is contained in:
parent
fafcf82538
commit
2153f48411
3 changed files with 20 additions and 42 deletions
|
@ -27,27 +27,6 @@ fi
|
||||||
# load old or init raspiblitz config
|
# load old or init raspiblitz config
|
||||||
source ${configFile}
|
source ${configFile}
|
||||||
|
|
||||||
# check if config files contains basic: version
|
|
||||||
if [ ${#raspiBlitzVersion} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: missing raspiBlitzVersion in (${configFile})!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if config files contains basic: network
|
|
||||||
if [ ${#network} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: missing network in (${configFile})!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if config files contains basic: chain
|
|
||||||
if [ ${#chain} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: missing chain in (${configFile})!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if config files contains basic: hostname
|
# check if config files contains basic: hostname
|
||||||
if [ ${#hostname} -eq 0 ]; then
|
if [ ${#hostname} -eq 0 ]; then
|
||||||
echo "FAIL see ${logFile}"
|
echo "FAIL see ${logFile}"
|
||||||
|
|
|
@ -26,27 +26,6 @@ if [ ${configExists} -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if config files contains basic: version
|
|
||||||
if [ ${#raspiBlitzVersion} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: missing raspiBlitzVersion in (${configFile})!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if config files contains basic: network
|
|
||||||
if [ ${#network} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: missing network in (${configFile})!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if config files contains basic: chain
|
|
||||||
if [ ${#chain} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: missing chain in (${configFile})!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# BASIC SYSTEM SETTINGS
|
# BASIC SYSTEM SETTINGS
|
||||||
##########################
|
##########################
|
||||||
|
|
|
@ -141,6 +141,26 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||||
configExists=$(ls ${configFile} | grep -c '.conf')
|
configExists=$(ls ${configFile} | grep -c '.conf')
|
||||||
if [ ${configExists} -eq 1 ]; then
|
if [ ${configExists} -eq 1 ]; then
|
||||||
echo "Found existing configuration" >> $logFile
|
echo "Found existing configuration" >> $logFile
|
||||||
|
source ${configFile}
|
||||||
|
# check if config files contains basic: version
|
||||||
|
if [ ${#raspiBlitzVersion} -eq 0 ]; then
|
||||||
|
echo "Invalid Config: missing raspiBlitzVersion in (${configFile})!" >> ${logFile}
|
||||||
|
configExists=0
|
||||||
|
fi
|
||||||
|
# check if config files contains basic: network
|
||||||
|
if [ ${#network} -eq 0 ]; then
|
||||||
|
echo "Invalid Config: missing network in (${configFile})!" >> ${logFile}
|
||||||
|
configExists=0
|
||||||
|
fi
|
||||||
|
# check if config files contains basic: chain
|
||||||
|
if [ ${#chain} -eq 0 ]; then
|
||||||
|
echo "Invalid Config: missing chain in (${configFile})!" >> ${logFile}
|
||||||
|
configExists=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# if config is still valid ...
|
||||||
|
if [ ${configExists} -eq 1 ]; then
|
||||||
|
echo "Found valid configuration" >> $logFile
|
||||||
sed -i "s/^state=.*/state=recovering/g" ${infoFile}
|
sed -i "s/^state=.*/state=recovering/g" ${infoFile}
|
||||||
sed -i "s/^message=.*/message='Starting Recover'/g" ${infoFile}
|
sed -i "s/^message=.*/message='Starting Recover'/g" ${infoFile}
|
||||||
echo "Calling Data Migration .." >> $logFile
|
echo "Calling Data Migration .." >> $logFile
|
||||||
|
|
Loading…
Add table
Reference in a new issue