2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ \
17 ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenNTPD/ \
18 ftp://ftp.fr.openbsd.org/pub/OpenBSD/OpenNTPD/ \
19 ftp://ftp.sunet.se/pub/OpenBSD/OpenNTPD/
20 PKG_MD5SUM:=afc34175f38d08867c1403d9008600b3
23 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
25 include $(INCLUDE_DIR)/package.mk
27 define Package/openntpd
32 A free and easy to use NTP (Network Time Protocol) implementation.
33 URL:=http://www.openntpd.org/
36 define Package/openntpd/conffiles
40 define Package/openntpd/postinst
47 # check if we are on real system
48 if [ -z "$${IPKG_INSTROOT}" ]; then
49 # create copies of passwd and group, if we use squashfs
50 rootfs=`mount |awk '/root/ { print $$5 }'`
51 if [ "$$rootfs" = "squashfs" ]; then
52 if [ -h /etc/group ]; then
54 cp -p /rom/etc/group /etc/group
56 if [ -h /etc/passwd ]; then
58 cp -p /rom/etc/passwd /etc/passwd
64 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
65 echo "adding group $$name to /etc/group"
66 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
68 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
69 echo "adding user $$name to /etc/passwd"
70 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
73 grep -q '^ntp[[:space:]]*123/udp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
74 [ $$? -ne 0 ] && echo "ntp 123/udp" >>$${IPKG_INSTROOT}/etc/services
77 define Build/Configure
78 $(call Build/Configure/Default, \
79 --with-builtin-arc4random \
80 --with-privsep-user=ntp \
86 $(MAKE) -C $(PKG_BUILD_DIR) \
87 CFLAGS="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
90 define Package/openntpd/install
91 install -d -m0755 $(1)/usr/sbin/
92 install -m0755 $(PKG_BUILD_DIR)/ntpd $(1)/usr/sbin/
93 install -d -m0755 $(1)/etc
94 install -m0644 ./files/ntpd.conf $(1)/etc/
95 install -d -m0755 $(1)/etc/init.d
96 install -m0755 ./files/ntpd.init $(1)/etc/init.d/ntpd
99 $(eval $(call BuildPackage,openntpd))