From ddb935bdec94faf1ec4643636d9cc451b6723eda Mon Sep 17 00:00:00 2001 From: rootzoll Date: Sun, 3 Feb 2019 23:22:58 +0100 Subject: [PATCH] #293 moving raspiblitz.conf creation after HDD gets added --- home.admin/40addHDD.sh | 16 +++++++++++++--- home.admin/95finalSetup.sh | 10 ---------- home.admin/_bootstrap.sh | 1 + 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/home.admin/40addHDD.sh b/home.admin/40addHDD.sh index 2d35c7b..7bdad82 100755 --- a/home.admin/40addHDD.sh +++ b/home.admin/40addHDD.sh @@ -2,7 +2,7 @@ echo "" ## get basic info -source /home/admin/raspiblitz.info 2>/dev/null +source /home/admin/raspiblitz.info echo "*** Adding HDD to the System ***" echo "started from state(${state})" @@ -14,7 +14,7 @@ if [ ${existsHDD} -gt 0 ]; then if [ ${mountOK} -eq 1 ]; then echo "FAIL - HDD is already mounted" echo "If you want to add HDD freshly to the system, then unmount the HDD first and try again" - else + else echo "" echo "*** Check HDD ***" formatExt4OK=$(lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL | grep BLOCKCHAIN | grep -c ext4) @@ -30,7 +30,7 @@ if [ ${existsHDD} -gt 0 ]; then echo ${fstabAdd} # adding the new line after line 3 to the /etc/fstab sudo sed "3 a ${fstabAdd}" -i /etc/fstab - else + else echo "UUID is already in /etc/fstab" fi fstabOK=$(cat /etc/fstab | grep -c ${uuid}) @@ -45,6 +45,16 @@ if [ ${existsHDD} -gt 0 ]; then echo "OK - HDD is mounted" echo "" + # init the RASPIBLITZ Config + source /home/admin/_version.info + configFile="/mnt/hdd/raspiblitz.conf" + echo "# RASPIBLITZ CONFIG FILE" > $configFile + echo "raspiBlitzVersion='${codeVersion}'" >> $configFile + echo "network=${network}" >> $configFile + echo "chain=${chain}" >> $configFile + echo "hostname=${hostname}" >> $configFile + sudo chmod 777 ${configFile} + # move SSH pub keys to HDD so that they survive an update echo "moving SSH pub keys to HDD" sudo cp -r /etc/ssh /mnt/hdd/ssh diff --git a/home.admin/95finalSetup.sh b/home.admin/95finalSetup.sh index b59676d..2dea167 100755 --- a/home.admin/95finalSetup.sh +++ b/home.admin/95finalSetup.sh @@ -19,16 +19,6 @@ dialog --backtitle "RaspiBlitz - Setup" --title " RaspiBlitz Setup is done :) " Press OK for a final reboot. " 10 42 -# init the RASPIBLITZ Config -echo "# RASPIBLITZ CONFIG FILE" > $configFile -echo "raspiBlitzVersion='${codeVersion}'" >> $configFile -sudo chmod 777 ${configFile} - -# transfer data from SD info file -echo "hostname=${hostname}" >> $configFile -echo "network=${network}" >> $configFile -echo "chain=${chain}" >> $configFile - # let migration/init script do the rest /home/admin/_bootstrap.migration.sh diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index dcd01f2..653b41e 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -51,6 +51,7 @@ echo "message=" >> $infoFile echo "network=${network}" >> $infoFile echo "chain=${chain}" >> $infoFile echo "setupStep=${setupStep}" >> $infoFile +echo "hostname=${hostname}" >> $infoFile sudo chmod 777 ${infoFile} ################################