Fix psmisc package installation, closes #771
authorFlorian Fainelli <florian@openwrt.org>
Sat, 9 Sep 2006 12:16:35 +0000 (12:16 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sat, 9 Sep 2006 12:16:35 +0000 (12:16 +0000)
SVN-Revision: 4778

openwrt/package/psmisc/Config.in
openwrt/package/psmisc/Makefile
openwrt/package/psmisc/ipkg/psmisc.postinst
openwrt/package/psmisc/ipkg/psmisc.postrm
openwrt/package/psmisc/ipkg/psmisc.preinst
openwrt/package/psmisc/ipkg/psmisc.prerm

index 50d13c05761de1ab1cdfc0fc619e4c87b52240b0..cb0f84505b308f745a238cd8ac52ff666abcce86 100644 (file)
@@ -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
index 11a8dc48d411619bd6741b117d35d3b2d5adb6b9..acd2cd1ef774d4438bb2990c27b811237c551003 100644 (file)
@@ -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:
index 4e6f6540c9c6b68f606645192dce60e98718aa00..3e4e999c74ba3be8ed424917cabaf90611e83fa8 100644 (file)
@@ -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
index 9dcab829f3ef78eba17ed88f4da98ecca66f7108..88695f5e9020c241011f8b381dcbbba7b24253d3 100644 (file)
@@ -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
 
index 1a5518d4fb9ab4b7c975b9fdf8ecb193292cb01c..bf0a2d685720f1051ed0fea8ebb84969921a147a 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 c229d222c5acad28d8889db5434266ffccefa7ee..ddb89330b5e5d42144c1758ec46d2233ce4c9218 100644 (file)
@@ -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