From 877814e0206bec838a83f31d42d7868ecf9d8075 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Wed, 4 Nov 2009 08:37:07 +0000 Subject: chrony: time synchronization recipe (chronyc and chronyd) Signed-off-by: Jonathan Cameron Signed-off-by: Stefan Schmidt --- recipes/chrony/chrony.conf | 7 +++++++ recipes/chrony/chrony.keys | 1 + recipes/chrony/chrony_git.bb | 35 +++++++++++++++++++++++++++++++++++ recipes/chrony/chrony_start.sh | 20 ++++++++++++++++++++ recipes/chrony/chrony_stop.sh | 20 ++++++++++++++++++++ recipes/chrony/init | 4 ++++ 6 files changed, 87 insertions(+) create mode 100644 recipes/chrony/chrony.conf create mode 100644 recipes/chrony/chrony.keys create mode 100644 recipes/chrony/chrony_git.bb create mode 100644 recipes/chrony/chrony_start.sh create mode 100644 recipes/chrony/chrony_stop.sh create mode 100644 recipes/chrony/init (limited to 'recipes/chrony') diff --git a/recipes/chrony/chrony.conf b/recipes/chrony/chrony.conf new file mode 100644 index 0000000000..995d5a2d6d --- /dev/null +++ b/recipes/chrony/chrony.conf @@ -0,0 +1,7 @@ +server timeserver offline minpoll 2 maxpoll 2 +keyfile /etc/chrony.keys +commandkey 1 +initstepslew 0 timeserver +driftfile /etc/chrony.drift +dumpdir /var/log/chrony +dumponexit \ No newline at end of file diff --git a/recipes/chrony/chrony.keys b/recipes/chrony/chrony.keys new file mode 100644 index 0000000000..00718adecc --- /dev/null +++ b/recipes/chrony/chrony.keys @@ -0,0 +1 @@ +1 opensesame \ No newline at end of file diff --git a/recipes/chrony/chrony_git.bb b/recipes/chrony/chrony_git.bb new file mode 100644 index 0000000000..bbba50c6f8 --- /dev/null +++ b/recipes/chrony/chrony_git.bb @@ -0,0 +1,35 @@ +DESCRIPTION = "Chrony time synchronization" +LICENSE = "GPL" +CHRONY_REV="fe2cfe1faee10b3d972f79fe30b5c8ac09469409" +DEPENDS += "readline" +REDEPENDS += "readline" + +PV = "1.23+gitr${CHRONY_REV}" + +SRC_URI = "git://git.tuxfamily.org/gitroot/chrony/chrony.git;protocol=git;rev=${CHRONY_REV} \ + file://chrony_start.sh \ + file://chrony_stop.sh \ + file://init \ + file://chrony.conf \ + file://chrony.keys \ +" +S = "${WORKDIR}/git" + +do_configure() { + ${S}/configure +} + +do_compile() { + unset CPPFLAGS + oe_runmake +} + +do_install_append() { + install -d ${D}${sysconfdir}/init.d + install -m 0644 ${WORKDIR}/chrony.conf ${D}${sysconfdir}/ + install -m 0644 ${WORKDIR}/chrony.keys ${D}${sysconfdir}/ + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/chronyd + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/chrony_start.sh ${D}${bindir} + install -m 0755 ${WORKDIR}/chrony_stop.sh ${D}${bindir} +} \ No newline at end of file diff --git a/recipes/chrony/chrony_start.sh b/recipes/chrony/chrony_start.sh new file mode 100644 index 0000000000..e50a3a4828 --- /dev/null +++ b/recipes/chrony/chrony_start.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +PROC=`ps | grep chronyd | grep -v grep`; + +if [ -n "$PROC" ]; then + + RESULT=`chronyc << ___EOF + password opensesame + online +___EOF` + + RESULT2=`echo $RESULT | grep OK` + if [ -n "$RESULT2" ]; then + echo 1 + else + echo 0; + fi +else + echo -1; +fi \ No newline at end of file diff --git a/recipes/chrony/chrony_stop.sh b/recipes/chrony/chrony_stop.sh new file mode 100644 index 0000000000..65b8f1fbf1 --- /dev/null +++ b/recipes/chrony/chrony_stop.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +PROC=`ps | grep chronyd | grep -v grep`; + +if [ -n "$PROC" ]; then + + RESULT=`chronyc << ___EOF + password opensesame + offline +___EOF` + + RESULT2=`echo $RESULT | grep OK` + if [ -n "$RESULT2" ]; then + echo 1 + else + echo 0; + fi +else + echo -1; +fi \ No newline at end of file diff --git a/recipes/chrony/init b/recipes/chrony/init new file mode 100644 index 0000000000..12c2fbbf47 --- /dev/null +++ b/recipes/chrony/init @@ -0,0 +1,4 @@ +if [ -f /usr/bin/chronyd -a -f /etc/chrony.conf ]; then + /usr/bin/chronyd + echo "Started chronyd" +fi -- cgit 1.2.3-korg