try again in boostrap script

This commit is contained in:
rootzoll
2021-08-20 23:23:37 +02:00
parent a11f92737c
commit 95a7b1e69c
3 changed files with 15 additions and 5 deletions

View File

@@ -52,9 +52,6 @@ do
# source info file fresh on every loop
source ${infoFile} 2>/dev/null
# make sure SSH server is configured & running
sudo /home/admin/config.scripts/blitz.ssh.sh checkrepair
####################################################
# SKIP BACKGROUND TASK LOOP ON CERTAIN SYSTEM STATES
# https://github.com/rootzoll/raspiblitz/issues/160

View File

@@ -94,6 +94,9 @@ sudo chmod 777 ${infoFile}
######################################
# CHECK SD CARD INCONSISTENT STATE
# make sure SSH server is configured & running
sudo /home/admin/config.scripts/blitz.ssh.sh checkrepair
# when the provision did not ran thru without error (ask user for fresh sd card)
provisionFlagExists=$(sudo ls /home/admin/provision.flag | grep -c 'provision.flag')
if [ "${provisionFlagExists}" == "1" ]; then

View File

@@ -52,14 +52,24 @@ if [ "$1" = "checkrepair" ]; then
countKeyFiles=$(sudo ls -la /etc/ssh/ssh_host_* 2>/dev/null | grep -c "/etc/ssh/ssh_host")
echo "# countKeyFiles(${countKeyFiles})"
if [ ${countKeyFiles} -lt 8 ]; then
sudo ls -la /etc/ssh
echo "# DETECTED: MISSING SSHD KEYFILES --> Generating new ones"
sudo ls -la /etc/ssh
sudo systemctl stop sshd
sudo ssh-keygen -A
sudo dpkg-reconfigure openssh-server
sudo systemctl start sshd
sudo ls -la /etc/ssh
sleep 3
sudo ls -la /etc/ssh
countKeyFiles=$(sudo ls -la /etc/ssh/ssh_host_* 2>/dev/null | grep -c "/etc/ssh/ssh_host")
echo "# countKeyFiles(${countKeyFiles})"
if [ ${countKeyFiles} -lt 8 ]; then
echo "# FAIL: Was not able to generate new sshd host keys"
else
echo "# OK: New sshd host leys generated"
fi
fi
# check if SSHD service is NOT running & active