From b5ed5ad5a3d41b4f67b3cb218c959fe2a99e434a Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sat, 9 Sep 2006 12:16:35 +0000 Subject: [PATCH] Fix psmisc package installation, closes #771 SVN-Revision: 4778 --- openwrt/package/psmisc/Config.in | 1 - openwrt/package/psmisc/Makefile | 40 +++++++-------------- openwrt/package/psmisc/ipkg/psmisc.postinst | 4 +-- openwrt/package/psmisc/ipkg/psmisc.postrm | 4 +-- openwrt/package/psmisc/ipkg/psmisc.preinst | 11 +++--- openwrt/package/psmisc/ipkg/psmisc.prerm | 4 +-- 6 files changed, 24 insertions(+), 40 deletions(-) diff --git a/openwrt/package/psmisc/Config.in b/openwrt/package/psmisc/Config.in index 50d13c0576..cb0f84505b 100644 --- a/openwrt/package/psmisc/Config.in +++ b/openwrt/package/psmisc/Config.in @@ -28,6 +28,5 @@ config BR2_PACKAGE_PSMISC_PSTREE default y if CONFIG_DEVEL depends BR2_PACKAGE_PSMISC select BR2_PACKAGE_LIBNCURSES - depends BR2_PACKAGE_PSMISC endmenu diff --git a/openwrt/package/psmisc/Makefile b/openwrt/package/psmisc/Makefile index 11a8dc48d4..acd2cd1ef7 100644 --- a/openwrt/package/psmisc/Makefile +++ b/openwrt/package/psmisc/Makefile @@ -35,8 +35,8 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared ); touch $@ - APPS:= +DEPEND:= ifneq ($(BR2_PACKAGE_PSMISC_FUSER),) APPS += /sbin/fuser @@ -46,6 +46,7 @@ APPS += /usr/bin/killall /bin/pidof endif ifneq ($(BR2_PACKAGE_PSMISC_PSTREE),) APPS += /usr/bin/pstree +DEPEND:=libncurses endif $(PKG_BUILD_DIR)/.built: @@ -61,36 +62,21 @@ $(PKG_BUILD_DIR)/.built: LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ $(TARGET_CONFIGURE_OPTS) \ prefix="$(PKG_INSTALL_DIR)" - - if [ -n "$(BR2_PACKAGE_PSMISC_KILLALL)" ];then $(CP) $(PKG_BUILD_DIR)/src/killall $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PSMISC_FUSER)" ];then $(CP) $(PKG_BUILD_DIR)/src/fuser $(PKG_INSTALL_DIR)/sbin;fi - if [ -n "$(BR2_PACKAGE_PSMISC_PSTREE)" ];then $(CP) $(PKG_BUILD_DIR)/src/pstree $(PKG_INSTALL_DIR)/usr/bin;fi - + [ -n "$(BR2_PACKAGE_PSMISC_KILLALL)" ] && cp -a $(PKG_BUILD_DIR)/src/killall $(PKG_INSTALL_DIR)/usr/bin/ + [ -n "$(BR2_PACKAGE_PSMISC_FUSER)" ] && cp -a $(PKG_BUILD_DIR)/src/fuser $(PKG_INSTALL_DIR)/sbin/ + [ -n "$(BR2_PACKAGE_PSMISC_PSTREE)" ] && cp -a $(PKG_BUILD_DIR)/src/pstree $(PKG_INSTALL_DIR)/usr/bin/ touch $@ $(IPKG_PSMISC): - install -d -m0755 $(IDIR_PSMISC)/usr/bin - install -d -m0755 $(IDIR_PSMISC)/sbin - install -d -m0755 $(IDIR_PSMISC)/bin - - if [ -n "$(BR2_PACKAGE_PSMISC_KILLALL)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/killall $(IDIR_PSMISC)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PSMISC_FUSER)" ];then $(CP) $(PKG_INSTALL_DIR)/sbin/fuser $(IDIR_PSMISC)/sbin;fi - if [ -n "$(BR2_PACKAGE_PSMISC_PSTREE)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/pstree $(IDIR_PSMISC)/usr/bin;fi - + cp -fpR $(PKG_INSTALL_DIR)/* $(IDIR_PSMISC)/ + grep -v -e ^BUILT -e /bin/sh $(IDIR_PSMISC)/CONTROL/preinst > $(IDIR_PSMISC)/CONTROL/preinst.tmp + rm $(IDIR_PSMISC)/CONTROL/preinst + echo -e "#!/bin/sh\nBUILT='$(APPS)'\n" > $(IDIR_PSMISC)/CONTROL/preinst + cat $(IDIR_PSMISC)/CONTROL/preinst.tmp >> $(IDIR_PSMISC)/CONTROL/preinst + rm $(IDIR_PSMISC)/CONTROL/preinst.tmp + echo "Depends: $(DEPEND)" >> $(IDIR_PSMISC)/CONTROL/control + echo "Description: Extra /proc utils: $(notdir $(APPS))" >> $(IDIR_PSMISC)/CONTROL/control $(RSTRIP) $(IDIR_PSMISC) - - # Insert BUILT variable into preinst script - grep -v -e ^BUILT -e /bin/sh $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/preinst > $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/preinst.tmp - rm $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/preinst - echo -e "#!/bin/sh\nBUILT='$(APPS)'\n" > $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/preinst - cat $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/preinst.tmp >> $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/preinst - rm $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/preinst.tmp - - if [ -n "$(BR2_PACKAGE_PSMISC_PSTREE)" ] || \ - [ -n "$(BR2_PACKAGE_PSMISC_PSTREE)" ]; then\ - echo "Depends: libncurses" >> $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/control; fi - echo "Description: Extra /proc utils: $(notdir $(APPS))" >> \$(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/control - $(IPKG_BUILD) $(IDIR_PSMISC) $(PACKAGE_DIR) mostlyclean: diff --git a/openwrt/package/psmisc/ipkg/psmisc.postinst b/openwrt/package/psmisc/ipkg/psmisc.postinst index 4e6f6540c9..3e4e999c74 100644 --- a/openwrt/package/psmisc/ipkg/psmisc.postinst +++ b/openwrt/package/psmisc/ipkg/psmisc.postinst @@ -1,9 +1,9 @@ #!/bin/sh -if [ -f /usr/bin/killall ] +if [ -f ${IPKG_INSTROOT}/usr/bin/killall ] then echo "Hard linking pidof to killall" - ln /usr/bin/killall /bin/pidof + ln ${IPKG_INSTROOT}/usr/bin/killall ${IPKG_INSTROOT}/bin/pidof fi exit 0 diff --git a/openwrt/package/psmisc/ipkg/psmisc.postrm b/openwrt/package/psmisc/ipkg/psmisc.postrm index 9dcab829f3..88695f5e90 100644 --- a/openwrt/package/psmisc/ipkg/psmisc.postrm +++ b/openwrt/package/psmisc/ipkg/psmisc.postrm @@ -5,10 +5,10 @@ echo "Recreating original BusyBox links: " for bin in $BINS do - if busybox 2>&1 | grep ${bin##/*/} >/dev/null + if [ ${IPKG_INSTROOT}/busybox 2>&1 | grep ${bin##/*/} >/dev/null ] then echo "$bin " - ln -sf /bin/busybox $bin + ln -sf ${IPKG_INSTROOT}/bin/busybox ${IPKG_INSTROOT}/$bin fi done diff --git a/openwrt/package/psmisc/ipkg/psmisc.preinst b/openwrt/package/psmisc/ipkg/psmisc.preinst index 1a5518d4fb..bf0a2d6857 100644 --- a/openwrt/package/psmisc/ipkg/psmisc.preinst +++ b/openwrt/package/psmisc/ipkg/psmisc.preinst @@ -1,20 +1,19 @@ #!/bin/sh - echo "Removing symbolic links to BusyBox: " for bin in $BUILT do - if [ -h $bin ] + if [ -h ${IPKG_INSTROOT}/$bin ] then echo "$bin " - rm -f $bin - elif [ -e $bin ] + rm -f ${IPKG_INSTROOT}/$bin + elif [ -e ${IPKG_INSTROOT}/$bin ] then echo -e "$bin exists but is not a symbolic link.\nRe-creating BusyBox links and aborting..." for bin in $BUILT do - if busybox 2>&1 | grep ${bin##/*/} >/dev/null && [ ! -e $bin ] + if [ ${IPKG_INSTROOT}/busybox 2>&1 | grep ${bin##/*/} >/dev/null ] && [ ! -e ${IPKG_INSTROOT}/$bin ] then - ln -s /bin/busybox $bin + ln -s ${IPKG_INSTROOT}/bin/busybox ${IPKG_INSTROOT}/$bin fi done exit 1 diff --git a/openwrt/package/psmisc/ipkg/psmisc.prerm b/openwrt/package/psmisc/ipkg/psmisc.prerm index c229d222c5..ddb89330b5 100644 --- a/openwrt/package/psmisc/ipkg/psmisc.prerm +++ b/openwrt/package/psmisc/ipkg/psmisc.prerm @@ -1,9 +1,9 @@ #!/bin/sh -if [ -f /sbin/pidof ] +if [ -f ${IPKG_INSTROOT}/sbin/pidof ] then echo "Removing hard link from pidof to killall" - rm -f /sbin/pidof + rm -f ${IPKG_INSTROOT}/sbin/pidof fi exit 0 -- 2.30.2