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
28 SUBMENU
:=Time Synchronization
32 URL
:=http
://www.openntpd.org
/
35 define Package
/openntpd
/description
36 A free and easy to use NTP
(Network Time Protocol
) implementation.
39 define Package
/openntpd
/conffiles
43 define Package
/openntpd
/postinst
50 # check if we are on real system
51 if
[ -z
"$${IPKG_INSTROOT}" ]; then
52 # create copies of passwd and group, if we use squashfs
53 rootfs
=`mount |awk '/root/ { print $$5 }'`
54 if
[ "$$rootfs" = "squashfs" ]; then
55 if
[ -h
/etc
/group
]; then
57 cp
-p
/rom
/etc
/group
/etc
/group
59 if
[ -h
/etc
/passwd
]; then
61 cp
-p
/rom
/etc
/passwd
/etc
/passwd
67 if
[ -z
"$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
68 echo
"adding group $$name to /etc/group"
69 echo
"$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc
/group
71 if
[ -z
"$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
72 echo
"adding user $$name to /etc/passwd"
73 echo
"$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc
/passwd
76 grep
-q
'^ntp[[:space:]]*123/udp' $${IPKG_INSTROOT}/etc
/services
2>/dev
/null
77 [ $$?
-ne
0 ] && echo
"ntp 123/udp" >>$${IPKG_INSTROOT}/etc
/services
80 define Build
/Configure
81 $(call Build
/Configure
/Default
, \
82 --with-builtin-arc4random \
83 --with-privsep-user
=ntp \
89 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
90 CFLAGS
="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
93 define Package
/openntpd
/install
94 $(INSTALL_DIR
) $(1)/usr
/sbin
/
95 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/ntpd
$(1)/usr
/sbin
/
96 $(INSTALL_DIR
) $(1)/etc
97 $(INSTALL_DATA
) .
/files
/ntpd.conf
$(1)/etc
/
98 $(INSTALL_DIR
) $(1)/etc
/init.d
99 $(INSTALL_BIN
) .
/files
/ntpd.init
$(1)/etc
/init.d
/ntpd
100 $(INSTALL_DIR
) $(1)/etc
/hotplug.d
/iface
101 $(INSTALL_BIN
) .
/files
/ntpd.hotplug
$(1)/etc
/hotplug.d
/iface
/20-ntpd
104 $(eval
$(call BuildPackage
,openntpd
))