DESCRIPTION:= is obselete
[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:=1
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 PKG_CAT:=zcat
22
23 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/openntpd
28 SUBMENU:=Time Synchronization
29 SECTION:=net
30 CATEGORY:=Network
31 TITLE:=NTP server
32 URL:=http://www.openntpd.org/
33 endef
34
35 define Package/openntpd/description
36 A free and easy to use NTP (Network Time Protocol) implementation.
37 endef
38
39 define Package/openntpd/conffiles
40 /etc/ntpd.conf
41 endef
42
43 define Package/openntpd/postinst
44 #!/bin/sh
45
46 name=ntp
47 id=50
48
49 # do not change below
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
56 rm /etc/group
57 cp -p /rom/etc/group /etc/group
58 fi
59 if [ -h /etc/passwd ]; then
60 rm /etc/passwd
61 cp -p /rom/etc/passwd /etc/passwd
62 fi
63 fi
64 fi
65
66 echo ""
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
70 fi
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
74 fi
75
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
78 endef
79
80 define Build/Configure
81 $(call Build/Configure/Default, \
82 --with-builtin-arc4random \
83 --with-privsep-user=ntp \
84 --with-adjtimex \
85 )
86 endef
87
88 define Build/Compile
89 $(MAKE) -C $(PKG_BUILD_DIR) \
90 CFLAGS="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
91 endef
92
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
102 endef
103
104 $(eval $(call BuildPackage,openntpd))