diff --git a/scripts/chroot.sh b/scripts/chroot.sh index c4ff81798ccb6d6030e5a2d9db6318731fc790e1..39c87e72d2875da48c15aeacd416cef33d1a7932 100755 --- a/scripts/chroot.sh +++ b/scripts/chroot.sh @@ -271,9 +271,17 @@ debian) fi fi - if [ ! -f /etc/ssh/ssh_host_dsa_key.pub ] ; then + if [ ! -f /etc/ssh/ssh_host_ecdsa_key.pub ] ; then rm -rf /etc/ssh/ssh_host_* || true dpkg-reconfigure openssh-server + sync + fi + + #There is a chance, if user reboots to soon, these are not saved, thus a zero size... + if [ ! -s /etc/ssh/ssh_host_ecdsa_key.pub ] ; then + rm -rf /etc/ssh/ssh_host_* || true + dpkg-reconfigure openssh-server + sync fi if [ -f /boot/uboot/SOC.sh ] && [ -f /boot/uboot/run_boot-scripts ] ; then @@ -336,9 +344,17 @@ ubuntu) fi fi - if [ ! -f /etc/ssh/ssh_host_dsa_key.pub ] ; then + if [ ! -f /etc/ssh/ssh_host_ecdsa_key.pub ] ; then + rm -rf /etc/ssh/ssh_host_* || true + dpkg-reconfigure openssh-server + sync + fi + + #There is a chance, if user reboots to soon, these are not saved, thus a zero size... + if [ ! -s /etc/ssh/ssh_host_ecdsa_key.pub ] ; then rm -rf /etc/ssh/ssh_host_* || true dpkg-reconfigure openssh-server + sync fi if [ -f /boot/uboot/SOC.sh ] && [ -f /boot/uboot/run_boot-scripts ] ; then