[packages] ntpd: allow coexistence with BusyBox ntpd by placing the deamon into ...
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 24 Oct 2011 22:13:18 +0000 (22:13 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 24 Oct 2011 22:13:18 +0000 (22:13 +0000)
SVN-Revision: 28572

net/ntpd/Makefile
net/ntpd/files/ntpd.init

index fcc7ef635b53b5fedcda2ca912b686b8176efa86..311c9d291f3ff5e26c83ffc5bdd158088d3b93dc 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ntp
 PKG_VERSION:=4.2.6p4
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/
@@ -117,8 +117,8 @@ ifeq ($(BUILD_VARIANT),ssl)
 endif
 
 define Package/ntpd/install
-       $(INSTALL_DIR) $(1)/usr/sbin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd/ntpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd/ntpd $(1)/sbin/
        $(INSTALL_DIR) $(1)/etc
        $(INSTALL_CONF) ./files/ntp.conf $(1)/etc/
        $(INSTALL_DIR) $(1)/etc/init.d
@@ -127,6 +127,18 @@ define Package/ntpd/install
        $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
 endef
 
+define Package/ntpd/postinst
+#!/bin/sh
+[ -L "$${IPKG_INSTROOT}/usr/sbin/ntpd" ] && rm -f "$${IPKG_INSTROOT}/usr/sbin/ntpd"
+exit 0
+endef
+
+define Package/ntpd/postrm
+#!/bin/sh
+/bin/busybox ntpd -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/sbin/ntpd
+exit 0
+endef
+
 Package/ntpd-ssl/conffiles = $(Package/ntpd/conffiles)
 Package/ntpd-ssl/install = $(Package/ntpd/install)
 
index d287226cc0d08331f556446d381ced33d514dbcb..d8dd4f55d812f6f399ffee2d887a2684d3a453dc 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006-2008 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 
 START=65
 
@@ -9,7 +9,7 @@ start() {
 #      ln -sf /dev/ttyS0 /dev/gps0
 #      /usr/sbin/setgarmin -d /dev/gps -c /etc/setgarmin.conf
        stop
-       /usr/sbin/ntpd -g -p $PIDFILE
+       /sbin/ntpd -g -p $PIDFILE
 }
 
 stop() {