Fix procps package installation when installed in target image (and as an external...
authorFlorian Fainelli <florian@openwrt.org>
Sat, 9 Sep 2006 12:16:14 +0000 (12:16 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sat, 9 Sep 2006 12:16:14 +0000 (12:16 +0000)
SVN-Revision: 4777

openwrt/package/procps/Config.in
openwrt/package/procps/Makefile
openwrt/package/procps/ipkg/procps.postinst
openwrt/package/procps/ipkg/procps.preinst
openwrt/package/procps/ipkg/procps.prerm

index 02199209d002c648239287046d95fb1aac5d8fd4..5e50cc43a9e6f20d764d43f535d887fd53a3b266 100644 (file)
@@ -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
index 72cca39320c2af27f0714db9cc2d434227b41ba7..a650ad4e9bb68ba1f2a455404ef7dbe3c829d4a0 100644 (file)
@@ -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:
index 9cc62fade16bad960fe06603696dfc43918fb142..ee676e288c8e15264b3c70296cac931a6ecccb49 100644 (file)
@@ -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
index 1a5518d4fb9ab4b7c975b9fdf8ecb193292cb01c..7c21dd8ea02d9479292fbe24cfdc1f0de378ef54 100644 (file)
@@ -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
index 89987d91d553c54c66f6aae1183b7ed627fe912c..ba833aee90a4b005adad4b6b4f05a9a25915e968 100644 (file)
@@ -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