From 4d9e015a2fe5540ea9badec5fb069c656001cf7b Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Tue, 19 Nov 2013 11:45:43 -0600
Subject: [PATCH] set date before generating ssh keys

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 scripts/chroot.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/chroot.sh b/scripts/chroot.sh
index de3f042a8..5fccdc812 100755
--- a/scripts/chroot.sh
+++ b/scripts/chroot.sh
@@ -245,14 +245,14 @@ debian)
 
 		case "\$1" in
 		start|reload|force-reload|restart)
+		        if [ -f "/opt/boot-scripts/set_date.sh" ] ; then
+		                /bin/sh /opt/boot-scripts/set_date.sh >/dev/null 2>&1 &
+		        fi
 		        if [ ! -f /etc/ssh/ssh_host_dsa_key.pub ] ; then
 		                rm -rf /etc/ssh/ssh_host_* || true
 		                dpkg-reconfigure openssh-server
 		        fi
 		        if [ -f /boot/uboot/SOC.sh ] && [ -f /boot/uboot/run_boot-scripts ] ; then
-		                if [ -f "/opt/boot-scripts/set_date.sh" ] ; then
-		                        /bin/sh /opt/boot-scripts/set_date.sh >/dev/null 2>&1 &
-		                fi
 		                board=\$(cat /boot/uboot/SOC.sh | grep "board" | awk -F"=" '{print \$2}')
 		                if [ -f "/opt/boot-scripts/\${board}.sh" ] ; then
 		                        /bin/sh /opt/boot-scripts/\${board}.sh >/dev/null 2>&1 &
@@ -285,14 +285,14 @@ ubuntu)
 		start on runlevel 2
 
 		script
+		if [ -f "/opt/boot-scripts/set_date.sh" ] ; then
+		        /bin/sh /opt/boot-scripts/set_date.sh >/dev/null 2>&1 &
+		fi
 		if [ ! -f /etc/ssh/ssh_host_dsa_key.pub ] ; then
 		        rm -rf /etc/ssh/ssh_host_* || true
 		        dpkg-reconfigure openssh-server
 		fi
 		if [ -f /boot/uboot/SOC.sh ] && [ -f /boot/uboot/run_boot-scripts ] ; then
-		        if [ -f "/opt/boot-scripts/set_date.sh" ] ; then
-		                /bin/sh /opt/boot-scripts/set_date.sh >/dev/null 2>&1 &
-		        fi
 		        board=\$(cat /boot/uboot/SOC.sh | grep "board" | awk -F"=" '{print \$2}')
 		        if [ -f "/opt/boot-scripts/\${board}.sh" ] ; then
 		                /bin/sh /opt/boot-scripts/\${board}.sh >/dev/null 2>&1 &
-- 
GitLab