Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fff-timeserver: new package to configure a timeserver
Signed-off-by: Tim Niemeyer <tim@tn-x.org> Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
- Loading branch information
Showing
6 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |
6 changes: 6 additions & 0 deletions
6
src/packages/fff/fff-timeserver/files/etc/uci-defaults/51-fff-timeserver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
. /lib/functions/fff/timeserver | ||
. /etc/community.cfg | ||
|
||
setTimeserver "${NTPD_IP}" |
24 changes: 24 additions & 0 deletions
24
src/packages/fff/fff-timeserver/files/lib/functions/fff/timeserver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters