Skip to content

Commit

Permalink
fff-timeserver: new package to configure a timeserver
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
  • Loading branch information
RedDog99 committed Jun 11, 2016
1 parent 484c7d7 commit 156e493
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 7 deletions.
2 changes: 0 additions & 2 deletions bsp/default/root_file_system/etc/config/timeserver

This file was deleted.

Expand Up @@ -4,9 +4,6 @@

/usr/sbin/configurenetwork

# Starting NTP-Client Daemon after 30s to ensure that the interface is up
( sleep 30 ; ntpd -p ${NTPD_IP} ) &

touch /tmp/started

exit 0
39 changes: 39 additions & 0 deletions src/packages/fff/fff-timeserver/Makefile
@@ -0,0 +1,39 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=fff-timeserver
PKG_VERSION:=0.0.1
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/fff-timeserver

include $(INCLUDE_DIR)/package.mk

define Package/fff-timeserver
SECTION:=base
CATEGORY:=Freifunk
TITLE:=Freifunk-Franken timeserver
URL:=http://www.freifunk-franken.de
endef

define Package/fff-timeserver/description
This is the Freifunk Franken Firmware timeserver package.
This packages configures the timeserver on the device.
endef

define Build/Prepare
echo "all: " > $(PKG_BUILD_DIR)/Makefile
endef

define Build/Configure
# nothing
endef

define Build/Compile
# nothing
endef

define Package/fff-timeserver/install
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,fff-timeserver))
@@ -0,0 +1,6 @@
#!/bin/sh

. /lib/functions/fff/timeserver
. /etc/community.cfg

setTimeserver "${NTPD_IP}"
24 changes: 24 additions & 0 deletions src/packages/fff/fff-timeserver/files/lib/functions/fff/timeserver
@@ -0,0 +1,24 @@
#!/bin/sh
# Copyright 2016 Tim Niemeyer
# License GPLv3

setTimeserver() {
if [ $# -ne "1" ]
then
echo "Usage: setTimeserver <ntp-server-address>"
return 1
fi

local ntp=$1

uci batch <<-__EOF__
set system.ntp='timeserver'
add_list system.ntp.server='$ntp'
set system.ntp.enable_server='0'
commit system
__EOF__

return 0
}

# vim: set noexpandtab:tabstop=4
5 changes: 3 additions & 2 deletions src/packages/fff/fff/Makefile
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=fff
PKG_VERSION:=0.0.2
PKG_RELEASE:=3
PKG_RELEASE:=4

PKG_BUILD_DIR:=$(BUILD_DIR)/fff

Expand All @@ -24,7 +24,8 @@ define Package/fff-base
+fff-support \
+fff-network \
+fff-sysupgrade \
+fff-wireless
+fff-wireless \
+fff-timeserver
endef

define Package/fff-base/description
Expand Down

0 comments on commit 156e493

Please sign in to comment.