fff-timeserver: new package to configure a timeserver

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
This commit is contained in:
Tim Niemeyer 2016-06-10 23:58:13 +02:00
parent 484c7d7bdd
commit 156e493afb
6 changed files with 72 additions and 7 deletions

View File

@ -1,2 +0,0 @@
config timeserver
option hostname time.fu-berlin.de

View File

@ -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

View File

@ -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))

View File

@ -0,0 +1,6 @@
#!/bin/sh
. /lib/functions/fff/timeserver
. /etc/community.cfg
setTimeserver "${NTPD_IP}"

View File

@ -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

View File

@ -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
@ -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