1629957f8cd4578597828ecfeeaa355b8745e24d
[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 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=openntpd
12 PKG_VERSION:=3.9p1
13 PKG_RELEASE:=2
14
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
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/openntpd
27 SUBMENU:=Time Synchronization
28 SECTION:=net
29 CATEGORY:=Network
30 TITLE:=NTP server
31 URL:=http://www.openntpd.org/
32 endef
33
34 define Package/openntpd/description
35 A free and easy to use NTP (Network Time Protocol) implementation.
36 endef
37
38 define Package/openntpd/conffiles
39 /etc/ntpd.conf
40 endef
41
42 define Package/openntpd/postinst
43 #!/bin/sh
44
45 name=ntp
46 id=50
47
48 # do not change below
49 # check if we are on real system
50 if [ -z "$${IPKG_INSTROOT}" ]; then
51 # create copies of passwd and group, if we use squashfs
52 rootfs=`mount |awk '/root/ { print $$5 }'`
53 if [ "$$rootfs" = "squashfs" ]; then
54 if [ -h /etc/group ]; then
55 rm /etc/group
56 cp -p /rom/etc/group /etc/group
57 fi
58 if [ -h /etc/passwd ]; then
59 rm /etc/passwd
60 cp -p /rom/etc/passwd /etc/passwd
61 fi
62 fi
63 fi
64
65 echo ""
66 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
67 echo "adding group $$name to /etc/group"
68 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
69 fi
70 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
71 echo "adding user $$name to /etc/passwd"
72 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
73 fi
74
75 grep -q '^ntp[[:space:]]*123/udp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
76 [ $$? -ne 0 ] && echo "ntp 123/udp" >>$${IPKG_INSTROOT}/etc/services
77 endef
78
79 define Build/Configure
80 $(call Build/Configure/Default, \
81 --with-builtin-arc4random \
82 --with-privsep-user=ntp \
83 --with-adjtimex \
84 )
85 endef
86
87 define Build/Compile
88 $(MAKE) -C $(PKG_BUILD_DIR) \
89 CFLAGS="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
90 endef
91
92 define Package/openntpd/install
93 $(INSTALL_DIR) $(1)/usr/sbin/
94 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd $(1)/usr/sbin/
95 $(INSTALL_DIR) $(1)/etc
96 $(INSTALL_DATA) ./files/ntpd.conf $(1)/etc/
97 $(INSTALL_DIR) $(1)/etc/init.d
98 $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
99 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
100 $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
101 endef
102
103 $(eval $(call BuildPackage,openntpd))