From ad29d3d5263740e2529c7459af685a4ff83ecc41 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sat, 9 Sep 2006 12:16:14 +0000 Subject: [PATCH] Fix procps package installation when installed in target image (and as an external package), partially closes #771 SVN-Revision: 4777 --- openwrt/package/procps/Config.in | 2 - openwrt/package/procps/Makefile | 77 +++++++-------------- openwrt/package/procps/ipkg/procps.postinst | 8 +-- openwrt/package/procps/ipkg/procps.preinst | 11 ++- openwrt/package/procps/ipkg/procps.prerm | 8 +-- 5 files changed, 39 insertions(+), 67 deletions(-) diff --git a/openwrt/package/procps/Config.in b/openwrt/package/procps/Config.in index 02199209d0..5e50cc43a9 100644 --- a/openwrt/package/procps/Config.in +++ b/openwrt/package/procps/Config.in @@ -33,14 +33,12 @@ config BR2_PACKAGE_PROCPS_TOP default y if CONFIG_DEVEL depends BR2_PACKAGE_PROCPS select BR2_PACKAGE_LIBNCURSES - depends BR2_PACKAGE_LIBNCURSES config BR2_PACKAGE_PROCPS_SLABTOP prompt "slabtop (requires libncurses) - display kernel slab cache info" bool default y if CONFIG_DEVEL depends BR2_PACKAGE_PROCPS - depends BR2_PACKAGE_LIBNCURSES select BR2_PACKAGE_LIBNCURSES config BR2_PACKAGE_PROCPS_PMAP diff --git a/openwrt/package/procps/Makefile b/openwrt/package/procps/Makefile index 72cca39320..a650ad4e9b 100644 --- a/openwrt/package/procps/Makefile +++ b/openwrt/package/procps/Makefile @@ -20,6 +20,7 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared touch $@ APPS:= +DEPEND:= ifneq ($(BR2_PACKAGE_PROCPS_PS),) APPS += /bin/ps @@ -29,9 +30,11 @@ APPS += /usr/bin/vmstat endif ifneq ($(BR2_PACKAGE_PROCPS_TOP),) APPS += /usr/bin/top +DEPEND:=libncurses endif ifneq ($(BR2_PACKAGE_PROCPS_SLABTOP),) APPS += /usr/bin/slabtop +DEPEND:=libncurses endif ifneq ($(BR2_PACKAGE_PROCPS_PMAP),) APPS += /usr/bin/pmap @@ -85,24 +88,21 @@ $(PKG_BUILD_DIR)/.built: $(TARGET_CONFIGURE_OPTS) \ prefix="$(PKG_INSTALL_DIR)/" \ ps/ps $(notdir $(APPS)) - - if [ -n "$(BR2_PACKAGE_PROCPS_PS)" ];then $(CP) $(PKG_BUILD_DIR)/ps/ps $(PKG_INSTALL_DIR)/bin/; fi - if [ -n "$(BR2_PACKAGE_PROCPS_VMSTAT)" ];then $(CP) $(PKG_BUILD_DIR)/vmstat $(PKG_INSTALL_DIR)/usr/bin; fi - if [ -n "$(BR2_PACKAGE_PROCPS_TOP)" ];then $(CP) $(PKG_BUILD_DIR)/top $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_SLABTOP)" ];then $(CP) $(PKG_BUILD_DIR)/slabtop $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_PMAP)" ];then $(CP) $(PKG_BUILD_DIR)/pmap $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_PWDX)" ];then $(CP) $(PKG_BUILD_DIR)/pwdx $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_W)" ];then $(CP) $(PKG_BUILD_DIR)/w $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_KILL)" ];then $(CP) $(PKG_BUILD_DIR)/kill $(PKG_INSTALL_DIR)/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_SKILL)" ];then $(CP) $(PKG_BUILD_DIR)/skill $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_FREE)" ];then $(CP) $(PKG_BUILD_DIR)/free $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_SYSCTL)" ];then $(CP) $(PKG_BUILD_DIR)/sysctl $(PKG_INSTALL_DIR)/sbin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_TLOAD)" ];then $(CP) $(PKG_BUILD_DIR)/tload $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_WATCH)" ];then $(CP) $(PKG_BUILD_DIR)/watch $(PKG_INSTALL_DIR)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_PGREP)" ];then $(CP) $(PKG_BUILD_DIR)/pgrep $(PKG_INSTALL_DIR)/usr/bin;fi - - $(CP) $(PKG_BUILD_DIR)/proc/libproc-$(PKG_VERSION).so $(PKG_INSTALL_DIR)/lib - + if [ -n "$(BR2_PACKAGE_PROCPS_PS)" ]; then cp -fpR $(PKG_BUILD_DIR)/ps/ps $(PKG_INSTALL_DIR)/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_VMSTAT)" ]; then cp -fpR $(PKG_BUILD_DIR)/vmstat $(PKG_INSTALL_DIR)/usr/bin; fi + if [ -n "$(BR2_PACKAGE_PROCPS_TOP)" ]; then cp -fpR $(PKG_BUILD_DIR)/top $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_SLABTOP)" ]; then cp -fpR $(PKG_BUILD_DIR)/slabtop $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_PMAP)" ]; then cp -fpR $(PKG_BUILD_DIR)/pmap $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_PWDX)" ]; then cp -fpR $(PKG_BUILD_DIR)/pwdx $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_W)" ]; then cp -fpR $(PKG_BUILD_DIR)/w $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_KILL)" ]; then cp -fpR $(PKG_BUILD_DIR)/kill $(PKG_INSTALL_DIR)/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_SKILL)" ]; then cp -fpR $(PKG_BUILD_DIR)/skill $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_FREE)" ]; then cp -fpR $(PKG_BUILD_DIR)/free $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_SYSCTL)" ]; then cp -fpR $(PKG_BUILD_DIR)/sysctl $(PKG_INSTALL_DIR)/sbin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_TLOAD)" ]; then cp -fpR $(PKG_BUILD_DIR)/tload $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_WATCH)" ]; then cp -fpR $(PKG_BUILD_DIR)/watch $(PKG_INSTALL_DIR)/usr/bin/; fi + if [ -n "$(BR2_PACKAGE_PROCPS_PGREP)" ]; then cp -fpR $(PKG_BUILD_DIR)/pgrep $(PKG_INSTALL_DIR)/usr/bin/; fi + cp -fpR $(PKG_BUILD_DIR)/proc/libproc-$(PKG_VERSION).so $(PKG_INSTALL_DIR)/lib/ touch $@ $(IPKG_PROCPS): @@ -110,40 +110,15 @@ $(IPKG_PROCPS): install -d -m0755 $(IDIR_PROCPS)/bin install -d -m0755 $(IDIR_PROCPS)/sbin install -d -m0755 $(IDIR_PROCPS)/lib - - if [ -n "$(BR2_PACKAGE_PROCPS_PS)" ];then $(CP) $(PKG_INSTALL_DIR)/bin/ps $(IDIR_PROCPS)/bin/;fi - if [ -n "$(BR2_PACKAGE_PROCPS_VMSTAT)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/vmstat $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_TOP)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/top $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_SLABTOP)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/slabtop $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_PMAP)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/pmap $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_PWDX)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/pwdx $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_W)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/w $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_KILL)" ];then $(CP) $(PKG_INSTALL_DIR)/bin/kill $(IDIR_PROCPS)/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_SKILL)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/skill $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_FREE)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/free $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_SYSCTL)" ];then $(CP) $(PKG_INSTALL_DIR)/sbin/sysctl $(IDIR_PROCPS)/sbin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_TLOAD)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/tload $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_WATCH)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/watch $(IDIR_PROCPS)/usr/bin;fi - if [ -n "$(BR2_PACKAGE_PROCPS_PGREP)" ];then $(CP) $(PKG_INSTALL_DIR)/usr/bin/pgrep $(IDIR_PROCPS)/usr/bin;fi - - $(CP) $(PKG_INSTALL_DIR)/lib/libproc-$(PKG_VERSION).so $(IDIR_PROCPS)/lib + cp -fpR $(PKG_INSTALL_DIR)/* $(IDIR_PROCPS)/ + grep -v -e ^BUILT -e /bin/sh $(IDIR_PROCPS)/CONTROL/preinst > $(IDIR_PROCPS)/CONTROL/preinst.tmp + rm $(IDIR_PROCPS)/CONTROL/preinst + echo -e "#!/bin/sh\nBUILT='$(APPS)'\n" > $(IDIR_PROCPS)/CONTROL/preinst + cat $(IDIR_PROCPS)/CONTROL/preinst.tmp >> $(IDIR_PROCPS)/CONTROL/preinst + rm $(IDIR_PROCPS)/CONTROL/preinst.tmp + echo "Depends: $(DEPEND)" >> $(IDIR_PROCPS)/CONTROL/control + echo "Description: /proc utilities: $(notdir $(APPS))" >> $(IDIR_PROCPS)/CONTROL/control $(RSTRIP) $(IDIR_PROCPS) - - # 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 - - # Insert ncurses dependancy if top or slabtop was selected - if [ -n "$(BR2_PACKAGE_PROCPS_TOP)" ] || \ - [ -n "$(BR2_PACKAGE_PROCPS_SLABTOP)" ]; then\ - echo "Depends: libncurses" >> $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/control; fi - - # Insert built apps to ipkg description - echo "Description: /proc utilities: $(notdir $(APPS))" >> $(PKG_INSTALL_DIR)/../ipkg/$(PKG_NAME)/CONTROL/control - $(IPKG_BUILD) $(IDIR_PROCPS) $(PACKAGE_DIR) mostlyclean: diff --git a/openwrt/package/procps/ipkg/procps.postinst b/openwrt/package/procps/ipkg/procps.postinst index 9cc62fade1..ee676e288c 100644 --- a/openwrt/package/procps/ipkg/procps.postinst +++ b/openwrt/package/procps/ipkg/procps.postinst @@ -1,15 +1,15 @@ #!/bin/sh -if [ -f /usr/bin/skill ] +if [ -f ${IPKG_INSTROOT}/usr/bin/skill ] then echo "Hard linking snice to skill" - ln /usr/bin/skill /usr/bin/snice + ln ${IPKG_INSTROOT}/usr/bin/skill /usr/bin/snice fi -if [ -f /usr/bin/pgrep ] +if [ -f ${IPKG_INSTROT}/usr/bin/pgrep ] then echo "Hard linking pkill to pgrep" - ln /usr/bin/pgrep /usr/bin/snice + ln ${IPKG_INSTROT}/usr/bin/pgrep ${IPKG_INSTROOT}/usr/bin/snice fi exit 0 diff --git a/openwrt/package/procps/ipkg/procps.preinst b/openwrt/package/procps/ipkg/procps.preinst index 1a5518d4fb..7c21dd8ea0 100644 --- a/openwrt/package/procps/ipkg/procps.preinst +++ b/openwrt/package/procps/ipkg/procps.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/procps/ipkg/procps.prerm b/openwrt/package/procps/ipkg/procps.prerm index 89987d91d5..ba833aee90 100644 --- a/openwrt/package/procps/ipkg/procps.prerm +++ b/openwrt/package/procps/ipkg/procps.prerm @@ -1,15 +1,15 @@ #!/bin/sh -if [ -f /usr/bin/pkill ] +if [ -f ${IPKG_INSTROOT}/usr/bin/pkill ] then echo "Removing hard link from pkill to pgrep" - rm -f /usr/bin/pkill + rm -f ${IPKG_INSTROOT}/usr/bin/pkill fi -if [ -f /usr/bin/snice ] +if [ -f ${IPKG_INSTROOT}/usr/bin/snice ] then echo "Removing hard link from snice to skill" - rm -f /usr/bin/skill + rm -f ${IPKG_INSTROOT}/usr/bin/skill fi exit 0 -- 2.30.2