From 9a00e2961c5e8c2f3924d2930f162888c85a5c9b Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 24 Oct 2011 22:13:18 +0000 Subject: [PATCH] [packages] ntpd: allow coexistence with BusyBox ntpd by placing the deamon into /sbin and removing/adding the busybox ntpd symlink in postinst/prerm SVN-Revision: 28572 --- net/ntpd/Makefile | 20 ++++++++++++++++---- net/ntpd/files/ntpd.init | 4 ++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/net/ntpd/Makefile b/net/ntpd/Makefile index fcc7ef635b..311c9d291f 100644 --- a/net/ntpd/Makefile +++ b/net/ntpd/Makefile @@ -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) diff --git a/net/ntpd/files/ntpd.init b/net/ntpd/files/ntpd.init index d287226cc0..d8dd4f55d8 100644 --- a/net/ntpd/files/ntpd.init +++ b/net/ntpd/files/ntpd.init @@ -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() { -- 2.30.2