[package] update radvd to 1.5, select kmod-ipv6 (#5966)
[openwrt/svn-archive/archive.git] / net / openntpd / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=openntpd
11 PKG_VERSION:=3.9p1
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ \
16 ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenNTPD/ \
17 ftp://ftp.fr.openbsd.org/pub/OpenBSD/OpenNTPD/ \
18 ftp://ftp.sunet.se/pub/OpenBSD/OpenNTPD/
19 PKG_MD5SUM:=afc34175f38d08867c1403d9008600b3
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/openntpd
24 SUBMENU:=Time Synchronization
25 SECTION:=net
26 CATEGORY:=Network
27 TITLE:=NTP server
28 URL:=http://www.openntpd.org/
29 endef
30
31 define Package/openntpd/description
32 A free and easy to use NTP (Network Time Protocol) implementation.
33 endef
34
35 define Package/openntpd/conffiles
36 /etc/ntpd.conf
37 endef
38
39 define Package/openntpd/postinst
40 #!/bin/sh
41
42 name=ntp
43 id=50
44
45 # do not change below
46 # check if we are on real system
47 if [ -z "$${IPKG_INSTROOT}" ]; then
48 # create copies of passwd and group, if we use squashfs
49 rootfs=`mount |awk '/root/ { print $$5 }'`
50 if [ "$$rootfs" = "squashfs" ]; then
51 if [ -h /etc/group ]; then
52 rm /etc/group
53 cp -p /rom/etc/group /etc/group
54 fi
55 if [ -h /etc/passwd ]; then
56 rm /etc/passwd
57 cp -p /rom/etc/passwd /etc/passwd
58 fi
59 fi
60 fi
61
62 echo ""
63 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
64 echo "adding group $$name to /etc/group"
65 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
66 fi
67 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
68 echo "adding user $$name to /etc/passwd"
69 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
70 fi
71
72 grep -q '^ntp[[:space:]]*123/udp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
73 [ $$? -ne 0 ] && echo "ntp 123/udp" >>$${IPKG_INSTROOT}/etc/services || exit 0
74 endef
75
76 define Build/Configure
77 $(call Build/Configure/Default, \
78 --with-builtin-arc4random \
79 --with-privsep-user=ntp \
80 --with-adjtimex \
81 )
82 endef
83
84 define Build/Compile
85 $(MAKE) -C $(PKG_BUILD_DIR) \
86 CFLAGS="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
87 endef
88
89 define Package/openntpd/install
90 $(INSTALL_DIR) $(1)/usr/sbin/
91 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd $(1)/usr/sbin/
92 $(INSTALL_DIR) $(1)/etc
93 $(INSTALL_DATA) ./files/ntpd.conf $(1)/etc/
94 $(INSTALL_DIR) $(1)/etc/init.d
95 $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
96 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
97 $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
98 endef
99
100 $(eval $(call BuildPackage,openntpd))