From e13a4fd8c463429f942d8a370eb6da41bce799f4 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 23 Feb 2019 15:48:22 +0200 Subject: [PATCH 1/4] /etc/profile: automatically export vars from /etc/environment --- board/common/overlay/etc/profile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/common/overlay/etc/profile b/board/common/overlay/etc/profile index f56cf28154..0224094d57 100644 --- a/board/common/overlay/etc/profile +++ b/board/common/overlay/etc/profile @@ -31,7 +31,8 @@ fi; test -f /data/etc/profile && source /data/etc/profile # global environment variables +set -a test -f /etc/environment && source /etc/environment test -f /data/etc/environment && source /data/etc/environment test -f /boot/etc/environment && source /boot/etc/environment - +set +a From 8e2734b18dc36473b5254c38b90f031da0e833f3 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Mon, 18 Mar 2019 23:23:57 +0200 Subject: [PATCH 2/4] writeimage.sh: use uppercase vars in static_ip.conf --- writeimage.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/writeimage.sh b/writeimage.sh index 36946f8370..665df07481 100755 --- a/writeimage.sh +++ b/writeimage.sh @@ -162,9 +162,9 @@ fi if [ -n "$IP" ] && [ -n "$GW" ] && [ -n "$DNS" ]; then msg "setting static IP configuration" conf=$BOOT/static_ip.conf - echo "static_ip=\"$IP\"" > $conf - echo "static_gw=\"$GW\"" >> $conf - echo "static_dns=\"$DNS\"" >> $conf + echo "STATIC_IP=\"$IP\"" > $conf + echo "STATIC_GW=\"$GW\"" >> $conf + echo "STATIC_DNS=\"$DNS\"" >> $conf fi msg "unmounting sdcard" From 6064dc424294f18fa7e99a7335977bc394933c96 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Mon, 18 Mar 2019 23:52:34 +0200 Subject: [PATCH 3/4] Continuously retry to set date upon failure --- board/common/overlay/etc/init.d/S50date | 35 ++++++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/board/common/overlay/etc/init.d/S50date b/board/common/overlay/etc/init.d/S50date index 6d7e43dfa8..5cd0781abf 100755 --- a/board/common/overlay/etc/init.d/S50date +++ b/board/common/overlay/etc/init.d/S50date @@ -33,24 +33,45 @@ source ${CONF} set_current_date_http() { date_str=$(curl -v -s -m ${DATE_TIMEOUT} -X GET http://${DATE_HOST} 2>&1 | grep Date | sed -e 's/< Date: //') - test -z "${date_str}" && return 1 - ${PROG_DATE} -u -D "%a, %d %b %Y %H:%M:%S" -s "${date_str}" > /dev/null - return $? + if [[ -n "${date_str}" ]]; then + ${PROG_DATE} -u -D "%a, %d %b %Y %H:%M:%S" -s "${date_str}" > /dev/null + logger -t date -s "current system date/time set to $(date) via HTTP" + return 0 + else + logger -t date -s "failed to set current system date/time via HTTP" + return 1 + fi } set_current_date_ntp() { cat ${NTP_CONF} | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ${PROG_NTPDATE} -t ${DATE_TIMEOUT} -s + if [[ $? == 0 ]]; then + logger -t date -s "current system date/time set to $(date) via NTP" + return 0 + else + logger -t date -s "failed to set current system date/time via NTP" + return 1 + fi } start_http() { msg_begin "Setting current date using http" - set_current_date_http || set_current_date_http - test $? == 0 && msg_done "$(${PROG_DATE})" || msg_fail + if set_current_date_http; then + sleep_interval=${DATE_INTERVAL} + msg_done "$(${PROG_DATE})" + else + sleep_interval=${DATE_TIMEOUT} + msg_fail + fi msg_begin "Starting http date updater" while true; do - sleep ${DATE_INTERVAL} - set_current_date_http + sleep ${sleep_interval} + if set_current_date_http; then + sleep_interval=${DATE_INTERVAL} + else + sleep_interval=${DATE_TIMEOUT} + fi done & msg_done } From a70281169fea8aa9836f9ad05f808705a1d90415 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Mon, 18 Mar 2019 23:56:51 +0200 Subject: [PATCH 4/4] dmesg.log: show relative time instead of timestamp --- board/common/overlay/etc/init.d/S05syslog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/common/overlay/etc/init.d/S05syslog b/board/common/overlay/etc/init.d/S05syslog index 78586fadf3..fe65281b6d 100755 --- a/board/common/overlay/etc/init.d/S05syslog +++ b/board/common/overlay/etc/init.d/S05syslog @@ -15,7 +15,7 @@ case "$1" in ${PROG} test $? == 0 && msg_done || msg_fail echo "---- booting ${OS_NAME} ${OS_VERSION} ----" >> ${DMESG_LOG} - ${PROG_D} -T -w >> ${DMESG_LOG} & + ${PROG_D} -w >> ${DMESG_LOG} & ;; stop)