Browse Source

moved config validation into boostrap

dev
rootzoll 6 years ago
parent
commit
2153f48411
  1. 21
      home.admin/_bootstrap.migration.sh
  2. 21
      home.admin/_bootstrap.provision.sh
  3. 20
      home.admin/_bootstrap.sh

21
home.admin/_bootstrap.migration.sh

@ -27,27 +27,6 @@ fi
# load old or init raspiblitz config
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
if [ ${#hostname} -eq 0 ]; then
echo "FAIL see ${logFile}"

21
home.admin/_bootstrap.provision.sh

@ -26,27 +26,6 @@ if [ ${configExists} -eq 0 ]; then
exit 1
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
##########################

20
home.admin/_bootstrap.sh

@ -141,6 +141,26 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
configExists=$(ls ${configFile} | grep -c '.conf')
if [ ${configExists} -eq 1 ]; then
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/^message=.*/message='Starting Recover'/g" ${infoFile}
echo "Calling Data Migration .." >> $logFile

Loading…
Cancel
Save