From b249e2425fc7392645ba4383bf0ba3079c4926f3 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 18 May 2005 15:14:13 +0000 Subject: Convert openntpd to new packaging style git-svn-id: svn://svn.openwrt.org/openwrt/trunk@937 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- openwrt/package/openntpd/Config.in | 9 ++- openwrt/package/openntpd/Makefile | 84 +++++++++++------------- openwrt/package/openntpd/files/S49ntpd | 3 - openwrt/package/openntpd/files/ntpd.conf | 3 + openwrt/package/openntpd/files/ntpd.init | 3 + openwrt/package/openntpd/ipkg/CONTROL/postinst | 35 ---------- openwrt/package/openntpd/ipkg/etc/init.d/S55ntpd | 3 - openwrt/package/openntpd/ipkg/etc/ntpd.conf | 3 - openwrt/package/openntpd/ipkg/openntpd.control | 9 +++ openwrt/package/openntpd/ipkg/openntpd.postinst | 35 ++++++++++ openwrt/package/openntpd/openntpd.control | 9 --- 11 files changed, 94 insertions(+), 102 deletions(-) delete mode 100755 openwrt/package/openntpd/files/S49ntpd create mode 100644 openwrt/package/openntpd/files/ntpd.conf create mode 100644 openwrt/package/openntpd/files/ntpd.init delete mode 100755 openwrt/package/openntpd/ipkg/CONTROL/postinst delete mode 100755 openwrt/package/openntpd/ipkg/etc/init.d/S55ntpd delete mode 100644 openwrt/package/openntpd/ipkg/etc/ntpd.conf create mode 100644 openwrt/package/openntpd/ipkg/openntpd.control create mode 100644 openwrt/package/openntpd/ipkg/openntpd.postinst delete mode 100644 openwrt/package/openntpd/openntpd.control diff --git a/openwrt/package/openntpd/Config.in b/openwrt/package/openntpd/Config.in index d61b56fb35..edf077b834 100644 --- a/openwrt/package/openntpd/Config.in +++ b/openwrt/package/openntpd/Config.in @@ -1,6 +1,9 @@ config BR2_PACKAGE_OPENNTPD - tristate "Openntpd" + tristate "openntpd - a FREE, easy to use implementation of NTP (Network Time Protocol)" default m if CONFIG_DEVEL help - NTP server - http://www.openntpd.org + NTP server + + http://www.openntpd.org + + diff --git a/openwrt/package/openntpd/Makefile b/openwrt/package/openntpd/Makefile index 59b504fa4a..5902da95bb 100644 --- a/openwrt/package/openntpd/Makefile +++ b/openwrt/package/openntpd/Makefile @@ -11,62 +11,54 @@ PKG_MD5SUM:=4584f226523776a3cdd2fb6f8212ba8d PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ \ ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenNTPD/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_CAT:=zcat -PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk -PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg -$(DL_DIR)/$(PKG_SOURCE): - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(TOPDIR)/package/rules.mk -$(PKG_BUILD_DIR)/.unpacked: $(DL_DIR)/$(PKG_SOURCE) - $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - touch $(PKG_BUILD_DIR)/.unpacked +$(eval $(call PKG_template,OPENNTPD,openntpd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) -$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.unpacked - (cd $(PKG_BUILD_DIR); rm -rf config.cache; \ +$(PKG_BUILD_DIR)/.configured: + (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS)" \ ./configure \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_TARGET_NAME) \ - --build=$(GNU_HOST_NAME) \ - --prefix=/usr \ - --exec-prefix=/usr \ - --bindir=/usr/bin \ - --sbindir=/usr/sbin \ - --libexecdir=/usr/lib \ - --sysconfdir=/etc \ - --datadir=/usr/share \ - --localstatedir=/var \ - --mandir=/usr/man \ - --infodir=/usr/info \ - --with-builtin-arc4random \ - --with-privsep-user=ntp \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_LARGEFILE) \ + $(DISABLE_NLS) \ + --with-builtin-arc4random \ + --with-privsep-user=ntp \ ); touch $(PKG_BUILD_DIR)/.configured -$(PKG_BUILD_DIR)/ntpd: $(PKG_BUILD_DIR)/.configured +$(PKG_BUILD_DIR)/.built: $(MAKE) -C $(PKG_BUILD_DIR) + touch $(PKG_BUILD_DIR)/.built -$(PKG_IPK): $(PKG_BUILD_DIR)/ntpd - mkdir -p $(PKG_IPK_DIR)/usr/sbin - cp -a ./ipkg/* $(PKG_IPK_DIR)/ - $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) - cp $(PKG_BUILD_DIR)/ntpd $(PKG_IPK_DIR)/usr/sbin/ - $(STRIP) $(PKG_IPK_DIR)/usr/sbin/* - mkdir -p $(PACKAGE_DIR) - find $(PKG_IPK_DIR) -name CVS | xargs rm -rf - $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR) - -$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) - $(IPKG) install $(PKG_IPK) - -source: $(DL_DIR)/$(PKG_SOURCE) -prepare: $(PKG_BUILD_DIR)/.unpacked -compile: $(PKG_IPK) -install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list +$(IPKG_OPENNTPD): + install -d -m0755 $(IDIR_OPENNTPD)/etc + install -m0644 ./files/ntpd.conf $(IDIR_OPENNTPD)/etc/ + install -d -m0755 $(IDIR_OPENNTPD)/etc/init.d + install -m0755 ./files/ntpd.init $(IDIR_OPENNTPD)/etc/init.d/S55ntpd + install -d -m0755 $(IDIR_OPENNTPD)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/ntpd $(IDIR_OPENNTPD)/usr/sbin/ + $(RSTRIP) $(IDIR_OPENNTPD) + $(IPKG_BUILD) $(IDIR_OPENNTPD) $(PACKAGE_DIR) -clean: - rm -rf $(PKG_BUILD_DIR) - rm -f $(PKG_IPK) diff --git a/openwrt/package/openntpd/files/S49ntpd b/openwrt/package/openntpd/files/S49ntpd deleted file mode 100755 index e528748780..0000000000 --- a/openwrt/package/openntpd/files/S49ntpd +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -mkdir -p `grep "^ntp:" /etc/passwd | cut -d: -f6` -/usr/sbin/ntpd -s diff --git a/openwrt/package/openntpd/files/ntpd.conf b/openwrt/package/openntpd/files/ntpd.conf new file mode 100644 index 0000000000..6993b8eba2 --- /dev/null +++ b/openwrt/package/openntpd/files/ntpd.conf @@ -0,0 +1,3 @@ +# use a random selection of 8 public stratum 2 servers +# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers +servers pool.ntp.org diff --git a/openwrt/package/openntpd/files/ntpd.init b/openwrt/package/openntpd/files/ntpd.init new file mode 100644 index 0000000000..e528748780 --- /dev/null +++ b/openwrt/package/openntpd/files/ntpd.init @@ -0,0 +1,3 @@ +#!/bin/sh +mkdir -p `grep "^ntp:" /etc/passwd | cut -d: -f6` +/usr/sbin/ntpd -s diff --git a/openwrt/package/openntpd/ipkg/CONTROL/postinst b/openwrt/package/openntpd/ipkg/CONTROL/postinst deleted file mode 100755 index daa0baf55d..0000000000 --- a/openwrt/package/openntpd/ipkg/CONTROL/postinst +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -name=ntp -id=50 - -# do not change below -# check if we are on real system -if [ -z "${IPKG_INSTROOT}" ]; then - # create copies of passwd and group, if we use squashfs - rootfs=`mount |awk '/root/ { print $5 }'` - if [ "$rootfs" = "squashfs" ]; then - if [ -h /etc/group ]; then - rm /etc/group - cp /rom/etc/group /etc/group - fi - if [ -h /etc/passwd ]; then - rm /etc/passwd - cp /rom/etc/passwd /etc/passwd - fi - fi -fi - -echo "" -if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/group)" ]; then - echo "adding group $name to /etc/group" - echo "${name}:x:${id}:" >> ${IPKG_INSTROOT}/etc/group -fi - -if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/passwd)" ]; then - echo "adding user $name to /etc/passwd" - echo "${name}:x:${id}:${id}:${name}:/tmp/.${name}:/bin/false" >> ${IPKG_INSTROOT}/etc/passwd -fi - -grep -q '^ntp[[:space:]]*123/udp' ${IPKG_INSTROOT}/etc/services 2>/dev/null -[ $? -ne 0 ] && echo "ntp 123/udp" >>${IPKG_INSTROOT}/etc/services diff --git a/openwrt/package/openntpd/ipkg/etc/init.d/S55ntpd b/openwrt/package/openntpd/ipkg/etc/init.d/S55ntpd deleted file mode 100755 index e528748780..0000000000 --- a/openwrt/package/openntpd/ipkg/etc/init.d/S55ntpd +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -mkdir -p `grep "^ntp:" /etc/passwd | cut -d: -f6` -/usr/sbin/ntpd -s diff --git a/openwrt/package/openntpd/ipkg/etc/ntpd.conf b/openwrt/package/openntpd/ipkg/etc/ntpd.conf deleted file mode 100644 index 6993b8eba2..0000000000 --- a/openwrt/package/openntpd/ipkg/etc/ntpd.conf +++ /dev/null @@ -1,3 +0,0 @@ -# use a random selection of 8 public stratum 2 servers -# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers -servers pool.ntp.org diff --git a/openwrt/package/openntpd/ipkg/openntpd.control b/openwrt/package/openntpd/ipkg/openntpd.control new file mode 100644 index 0000000000..8bc341f38e --- /dev/null +++ b/openwrt/package/openntpd/ipkg/openntpd.control @@ -0,0 +1,9 @@ +Package: openntpd +Priority: optional +Section: net +Maintainer: Laurent Papier +Source: buildroot internal +Description: OpenNTPD is a FREE, easy to use implementation of NTP + (the Network Time Protocol). It provides the ability to sync the + local clock to remote NTP servers and can act as NTP server itself, + redistributing the local clock. diff --git a/openwrt/package/openntpd/ipkg/openntpd.postinst b/openwrt/package/openntpd/ipkg/openntpd.postinst new file mode 100644 index 0000000000..4b2ffe9df6 --- /dev/null +++ b/openwrt/package/openntpd/ipkg/openntpd.postinst @@ -0,0 +1,35 @@ +#!/bin/sh + +name=ntp +id=50 + +# do not change below +# check if we are on real system +if [ -z "${IPKG_INSTROOT}" ]; then + # create copies of passwd and group, if we use squashfs + rootfs=`mount |awk '/root/ { print $5 }'` + if [ "$rootfs" = "squashfs" ]; then + if [ -h /etc/group ]; then + rm /etc/group + cp -p /rom/etc/group /etc/group + fi + if [ -h /etc/passwd ]; then + rm /etc/passwd + cp -p /rom/etc/passwd /etc/passwd + fi + fi +fi + +echo "" +if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/group)" ]; then + echo "adding group $name to /etc/group" + echo "${name}:x:${id}:" >> ${IPKG_INSTROOT}/etc/group +fi + +if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/passwd)" ]; then + echo "adding user $name to /etc/passwd" + echo "${name}:x:${id}:${id}:${name}:/tmp/.${name}:/bin/false" >> ${IPKG_INSTROOT}/etc/passwd +fi + +grep -q '^ntp[[:space:]]*123/udp' ${IPKG_INSTROOT}/etc/services 2>/dev/null +[ $? -ne 0 ] && echo "ntp 123/udp" >>${IPKG_INSTROOT}/etc/services diff --git a/openwrt/package/openntpd/openntpd.control b/openwrt/package/openntpd/openntpd.control deleted file mode 100644 index 8bc341f38e..0000000000 --- a/openwrt/package/openntpd/openntpd.control +++ /dev/null @@ -1,9 +0,0 @@ -Package: openntpd -Priority: optional -Section: net -Maintainer: Laurent Papier -Source: buildroot internal -Description: OpenNTPD is a FREE, easy to use implementation of NTP - (the Network Time Protocol). It provides the ability to sync the - local clock to remote NTP servers and can act as NTP server itself, - redistributing the local clock. -- cgit v1.2.3