Add procps
authorFlorian Fainelli <florian@openwrt.org>
Sun, 3 Sep 2006 22:22:57 +0000 (22:22 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 3 Sep 2006 22:22:57 +0000 (22:22 +0000)
SVN-Revision: 4744

openwrt/package/Config.in
openwrt/package/Makefile
openwrt/package/procps/Config.in [new file with mode: 0644]
openwrt/package/procps/Makefile [new file with mode: 0644]
openwrt/package/procps/ipkg/procps.control [new file with mode: 0644]
openwrt/package/procps/ipkg/procps.postinst [new file with mode: 0644]
openwrt/package/procps/ipkg/procps.postrm [new file with mode: 0644]
openwrt/package/procps/ipkg/procps.preinst [new file with mode: 0644]
openwrt/package/procps/ipkg/procps.prerm [new file with mode: 0644]

index b2f2138a65b932928518680829506ab5ffb56139..bcc6f17648f1c7c79e8921f44550fb2d66557bcd 100644 (file)
@@ -17,6 +17,7 @@ source "package/lua/Config.in"
 source "package/microperl/Config.in"
 source "package/monit/Config.in"
 source "package/osiris/Config.in"
+source "package/procps/Config.in"
 menu "sablevm - a Java Virtual Machine (JVM) implementation"
 source "package/sablevm/Config.in"
 source "package/sablevm-classpath/Config.in"
index 15821ec740f4efe950002fcd5f292e73554cea06..79a45cffd3f15103680adf8310b8d364a286ebcf 100644 (file)
@@ -91,6 +91,7 @@ package-$(BR2_PACKAGE_POSTGRESQL) += postgresql
 package-$(BR2_PACKAGE_PPP) += ppp
 package-$(BR2_PACKAGE_PPTP) += pptp
 package-$(BR2_PACKAGE_PPTPD) += pptpd
+package-$(BR2_PACKAGE_PROCPS) += procps
 package-$(BR2_PACKAGE_QUAGGA) += quagga
 package-$(BR2_PACKAGE_RADVD) += radvd
 package-$(BR2_COMPILE_RADIUSCLIENT_NG) += radiusclient-ng
diff --git a/openwrt/package/procps/Config.in b/openwrt/package/procps/Config.in
new file mode 100644 (file)
index 0000000..0219920
--- /dev/null
@@ -0,0 +1,106 @@
+menu "Basic /proc utilities"
+
+config BR2_PACKAGE_PROCPS
+       prompt "Basic /proc utilities"
+       tristate
+       default m if CONFIG_DEVEL
+       help
+       procps is a package that has many small useful utilities that 
+       give information about processes using the /proc filesystem. The 
+       package includes the programs ps, vmstat, top, w, kill, free, slabtop, 
+       skill, and others.
+
+       Note that versions of many of these programs are included in BusyBox.
+       This package will replace many of them.
+
+       http://procps.sourceforge.net/
+
+config BR2_PACKAGE_PROCPS_PS
+       prompt "ps - report a snapshot of the current processes."
+       bool
+       default y if CONFIG_DEVEL
+       depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_VMSTAT
+       prompt "vmstat - Report virtual memory statistics"
+       bool
+       default y if CONFIG_DEVEL
+       depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_TOP
+       prompt "top (requires libncurses) - display Linux tasks"
+       bool
+       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
+        prompt "pmap - report memory map of a process"
+        bool
+        default y if CONFIG_DEVEL
+        depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_PWDX
+        prompt "pwdx - report current working directory of a process"
+        bool
+        default y if CONFIG_DEVEL
+        depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_W
+       prompt "w - Show who is logged on and what they are doing"
+       bool
+       default y if CONFIG_DEVEL
+       depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_KILL
+        prompt "kill - terminate a process"
+        bool
+        default y if CONFIG_DEVEL
+        depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_SKILL
+        prompt "skill, snice - send a signal or report process status"
+        bool
+        default y if CONFIG_DEVEL
+        depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_PGREP
+       prompt "pgrep, pkill - lookup or signal processes based on name or other attributes"
+       bool
+       default y if CONFIG_DEVEL
+       depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_FREE
+        prompt "free - display system memory information"
+        bool
+        default y if CONFIG_DEVEL
+        depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_SYSCTL
+        prompt "sysctl - configure kernel parameters at runtime"
+        bool
+        default y if CONFIG_DEVEL
+        depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_TLOAD
+       prompt "tload - graphic representation of system load average"
+       bool
+       default y if CONFIG_DEVEL
+       depends BR2_PACKAGE_PROCPS
+
+config BR2_PACKAGE_PROCPS_WATCH
+       prompt "watch - execute a program periodically with fullscreen output"
+       bool
+       default y if CONFIG_DEVEL
+       depends BR2_PACKAGE_PROCPS
+
+endmenu
diff --git a/openwrt/package/procps/Makefile b/openwrt/package/procps/Makefile
new file mode 100644 (file)
index 0000000..72cca39
--- /dev/null
@@ -0,0 +1,151 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=procps
+PKG_VERSION:=3.2.7
+PKG_RELEASE:=1
+PKG_MD5SUM:=f490bca772b16472962c7b9f23b1e97d
+
+PKG_SOURCE_URL:=http://procps.sourceforge.net/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(TOPDIR)/package/rules.mk
+
+$(eval $(call PKG_template,PROCPS,$(PKG_NAME),$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+
+$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
+       touch $@
+
+APPS:=
+
+ifneq ($(BR2_PACKAGE_PROCPS_PS),)
+APPS += /bin/ps
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_VMSTAT),)
+APPS += /usr/bin/vmstat
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_TOP),)
+APPS += /usr/bin/top
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_SLABTOP),)
+APPS += /usr/bin/slabtop
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_PMAP),)
+APPS += /usr/bin/pmap
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_PWDX),)
+APPS += /usr/bin/pwdx
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_W),)
+APPS += /usr/bin/w
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_KILL),)
+APPS += /bin/kill
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_SKILL),)
+APPS += /usr/bin/skill
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_PKILL),)
+APPS += /usr/bin/pkill
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_FREE),)
+APPS += /usr/bin/free
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_SNICE),)
+APPS += /usr/bin/snice
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_SYSCTL),)
+APPS += /sbin/sysctl
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_TLOAD),)
+APPS += /usr/bin/tload
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_WATCH),)
+APPS += /usr/bin/watch
+endif
+ifneq ($(BR2_PACKAGE_PROCPS_PGREP),)
+APPS += /usr/bin/pgrep
+endif
+
+$(PKG_BUILD_DIR)/.built:
+       rm -rf $(PKG_INSTALL_DIR)
+       mkdir -p $(PKG_INSTALL_DIR)/usr/bin
+       mkdir -p $(PKG_INSTALL_DIR)/bin
+       mkdir -p $(PKG_INSTALL_DIR)/lib
+       mkdir -p $(PKG_INSTALL_DIR)/sbin
+       #Note here that we pass cross-compiler as default compiler to use
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC=$(TARGET_CC) \
+               CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
+               LD="$(TARGET_CC)" \
+               LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
+               $(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
+
+       touch $@
+
+$(IPKG_PROCPS):
+       install -d -m0755 $(IDIR_PROCPS)/usr/bin
+       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
+       $(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:
+       make -C $(PKG_BUILD_DIR) clean
+       rm $(PKG_BUILD_DIR)/.built
diff --git a/openwrt/package/procps/ipkg/procps.control b/openwrt/package/procps/ipkg/procps.control
new file mode 100644 (file)
index 0000000..2913d74
--- /dev/null
@@ -0,0 +1,3 @@
+Package: procps
+Priority: optional
+Section: admin
diff --git a/openwrt/package/procps/ipkg/procps.postinst b/openwrt/package/procps/ipkg/procps.postinst
new file mode 100644 (file)
index 0000000..9cc62fa
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ -f /usr/bin/skill ]
+then
+    echo "Hard linking snice to skill"
+    ln /usr/bin/skill /usr/bin/snice
+fi
+
+if [ -f /usr/bin/pgrep ]
+then
+    echo "Hard linking pkill to pgrep"
+    ln /usr/bin/pgrep /usr/bin/snice
+fi
+
+exit 0
diff --git a/openwrt/package/procps/ipkg/procps.postrm b/openwrt/package/procps/ipkg/procps.postrm
new file mode 100644 (file)
index 0000000..caefed3
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+BINS="/usr/bin/free /bin/kill /usr/bin/pgrep /usr/bin/pkill /usr/bin/pmap \
+/usr/bin/skill /usr/bin/pwdx /usr/bin/slabtop /usr/bin/snice /sbin/sysctl \
+/usr/bin/tload /usr/bin/top /usr/bin/uptime /usr/bin/vmstat /usr/bin/w \
+/usr/bin/watch /bin/ps"
+
+echo "Recreating original BusyBox links: "
+
+for bin in $BINS
+do
+    if busybox 2>&1 | grep ${bin##/*/} >/dev/null
+    then
+         echo "$bin "
+         ln -sf /bin/busybox $bin
+    fi
+done
+
+exit 0
diff --git a/openwrt/package/procps/ipkg/procps.preinst b/openwrt/package/procps/ipkg/procps.preinst
new file mode 100644 (file)
index 0000000..1a5518d
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+echo "Removing symbolic links to BusyBox: "
+for bin in $BUILT
+do
+    if [ -h $bin ]
+    then
+        echo "$bin "
+        rm -f $bin
+    elif [ -e $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 ]
+            then
+                ln -s /bin/busybox $bin
+            fi
+        done
+        exit 1
+    fi
+done
+
+exit 0
diff --git a/openwrt/package/procps/ipkg/procps.prerm b/openwrt/package/procps/ipkg/procps.prerm
new file mode 100644 (file)
index 0000000..89987d9
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ -f /usr/bin/pkill ]
+then
+    echo "Removing hard link from pkill to pgrep"
+    rm -f /usr/bin/pkill
+fi
+
+if [ -f /usr/bin/snice ]
+then
+    echo "Removing hard link from snice to skill"
+    rm -f /usr/bin/skill
+fi
+
+exit 0