84375afcf99b3e47d27c7f4becdb56ff2aa07770
[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.7p1
13 PKG_RELEASE:=1
14 PKG_MD5SUM:=10ed8eefd760e5819efcf3277b118f47
15
16 # space separated list or special @SF for sourceforge projects
17 PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ \
18 ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenNTPD/ \
19 ftp://ftp.fr.openbsd.org/pub/OpenBSD/OpenNTPD/ \
20 ftp://ftp.sunet.se/pub/OpenBSD/OpenNTPD/
21 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
22 PKG_CAT:=zcat
23
24 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/openntpd
29 SECTION:=net
30 CATEGORY:=Network
31 TITLE:=A free and easy to use NTP (Network Time Protocol) implementation
32 DESCRIPTION:=NTP server
33 URL:=http://www.openntpd.org/
34 endef
35
36 define Package/openntpd/conffiles
37 /etc/ntpd.conf
38 endef
39
40 define Package/openntpd/postinst
41 #!/bin/sh
42
43 name=ntp
44 id=50
45
46 # do not change below
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
53 rm /etc/group
54 cp -p /rom/etc/group /etc/group
55 fi
56 if [ -h /etc/passwd ]; then
57 rm /etc/passwd
58 cp -p /rom/etc/passwd /etc/passwd
59 fi
60 fi
61 fi
62
63 echo ""
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
67 fi
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
71 fi
72
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
75 endef
76
77 define Build/Configure
78 $(call Build/Configure/Default, --with-builtin-arc4random \
79 --with-privsep-user=ntp \
80 --with-adjtimex)
81 endef
82
83 define Build/Compile
84 $(MAKE) -C $(PKG_BUILD_DIR) \
85 $(TARGET_CONFIGURE_OPTS) \
86 CFLAGS="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
87 endef
88
89 define Package/openntpd/install
90 install -d -m0755 $(1)/etc
91 install -m0644 ./files/ntpd.conf $(1)/etc/
92 install -d -m0755 $(1)/etc/init.d
93 install -m0755 ./files/ntpd.init $(1)/etc/init.d/S55ntpd
94 install -d -m0755 $(1)/usr/sbin/
95 install -m0755 $(PKG_BUILD_DIR)/ntpd $(1)/usr/sbin/
96 endef
97
98 $(eval $(call BuildPackage,openntpd))