[X2Go-Commits] [live-build-x2go] 36/42: added support for ntp= boot parameter, to allow the use of non-debian ntp servers

git-admin at x2go.org git-admin at x2go.org
Wed Jan 24 18:11:43 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch feature/mate-minidesktop-stretch
in repository live-build-x2go.

commit fa886d511d78748a1a069bb62b7fd38f49c23181
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Wed Jan 24 09:16:36 2018 +0100

    added support for ntp= boot parameter, to allow the use of non-debian ntp servers
---
 config/includes.chroot/lib/live/config/2000-settime | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/config/includes.chroot/lib/live/config/2000-settime b/config/includes.chroot/lib/live/config/2000-settime
index cb0ada3..7bbdd14 100755
--- a/config/includes.chroot/lib/live/config/2000-settime
+++ b/config/includes.chroot/lib/live/config/2000-settime
@@ -15,6 +15,20 @@ if [ "\$METHOD" = "loopback" ] || [ "\$METHOD" = "none" ]; then
         exit 0
 fi
 
+NTPSERVERS=\$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | \
+		   awk -F'=' ' /^ntp=/ { print \$2 }' | \
+		   tr -dc 'a-zA-Z0-9.\-' | \
+		   tr '[:upper:]' '[:lower:]' )
+
+if [ "\$NTPSERVERS" = "false" ] || [ "\$NTPSERVERS" = "off" ] || [ "\$NTPSERVERS" = "0" ] ; then
+	NTPCOMMAND="false"
+elif [ -n "\$NTPSERVERS" ] ; then
+	NTPCOMMAND="ntpdate -s -b \$NTPSERVERS"
+else
+	NTPCOMMAND="ntpdate-debian -s -b"
+fi
+
+
 (	
 	while ! [ -c /dev/tty8 ] ; do
 		echo -en "\n'\$0' is waiting for tty8 to become available."
@@ -33,7 +47,9 @@ fi
 
 	sleep 20 # make sure IP, Route, DNS are all up
 
-	if ntpdate-debian -s && hwclock --systohc ; then
+	if [ "\$NTPCOMMAND" = "false" ] ; then
+		echo -en "\n\$(date +'%F | %T | ')'\$0' - NTP disabled via boot parameter. Timestamps will be based on CMOS Clock." | tee -a /dev/tty8
+	elif \$NTPCOMMAND && hwclock --systohc ; then
 		echo -en "\n\$(date +'%F | %T | ')'\$0' - time has been set." | tee -a /dev/tty8
 	else
 		echo -en "\n\$(date +'%F | %T | ')'\$0' - error setting time. Timestamps will be based on CMOS Clock." | tee -a /dev/tty8

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list