Update image setup script to wait for SSH to come back and resume automatically after reboot.

This commit is contained in:
Jarno Rantanen 2019-04-10 12:24:25 +03:00
parent 06a9a36a9e
commit e39d644be0

View File

@ -17,7 +17,7 @@ function question {
echo -e "\n🛑 $1" echo -e "\n🛑 $1"
} }
function ssh { function ssh {
/usr/bin/ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "pi@$IP" "$1" /usr/bin/ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 "pi@$IP" "$1"
} }
function scp { function scp {
/usr/bin/scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@" "pi@$IP:/home/pi" /usr/bin/scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@" "pi@$IP:/home/pi"
@ -112,8 +112,11 @@ ssh "sudo sed -i 's/raspberrypi/chilipie-kiosk/g' /etc/hosts"
working "Rebooting the Pi" working "Rebooting the Pi"
ssh "sudo reboot" ssh "sudo reboot"
question "Wait until the Pi has rebooted, press enter to continue" echo "Waiting for host to come back up..."
read until ssh "echo OK"
do
sleep 1
done
working "Finishing the root partition resize" working "Finishing the root partition resize"
ssh "df -h . && sudo resize2fs /dev/mmcblk0p2 && df -h ." ssh "df -h . && sudo resize2fs /dev/mmcblk0p2 && df -h ."