Browse Source

use desktop ps by default, add suid bit via postinst

Waldemar Brodkorb 13 years ago
parent
commit
fc17116201

+ 1 - 1
package/busybox/Makefile

@@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=		busybox
 PKG_VERSION:=		1.17.2
-PKG_RELEASE:=		3
+PKG_RELEASE:=		4
 PKG_MD5SUM:=		7360b7138b899ee7fc885791c740c3c3
 PKG_DESCR:=		Core utilities for embedded systems
 PKG_SECTION:=		base

+ 1 - 0
package/busybox/files/busybox.postinst

@@ -6,3 +6,4 @@ add_rcconf watchdog watchdog NO
 add_rcconf watchdog_flags watchdog_flags '-t 10 -T 20'
 add_rcconf 'use "-C32" normally, "NO" to disable' syslogd_flags '-C32'
 add_rcconf inetd inetd NO
+chmod u+s /bin/busybox

+ 110 - 0
package/busybox/patches/008-ps.patch

@@ -0,0 +1,110 @@
+--- busybox-1.17.2.orig/procps/ps.c	2010-08-23 02:44:35.000000000 +0200
++++ busybox-1.17.2/procps/ps.c	2010-11-27 23:47:59.000000000 +0100
+@@ -14,8 +14,6 @@
+ /* Absolute maximum on output line length */
+ enum { MAX_WIDTH = 2*1024 };
+ 
+-#if ENABLE_DESKTOP
+-
+ #include <sys/times.h> /* for times() */
+ #ifndef AT_CLKTCK
+ #define AT_CLKTCK 17
+@@ -544,98 +542,3 @@ int ps_main(int argc UNUSED_PARAM, char 
+ 
+ 	return EXIT_SUCCESS;
+ }
+-
+-
+-#else /* !ENABLE_DESKTOP */
+-
+-
+-int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+-int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
+-{
+-	procps_status_t *p;
+-	int psscan_flags = PSSCAN_PID | PSSCAN_UIDGID
+-			| PSSCAN_STATE | PSSCAN_VSZ | PSSCAN_COMM;
+-	unsigned terminal_width IF_NOT_FEATURE_PS_WIDE(= 79);
+-	enum {
+-		OPT_Z = (1 << 0) * ENABLE_SELINUX,
+-		OPT_T = (1 << ENABLE_SELINUX) * ENABLE_FEATURE_SHOW_THREADS,
+-	};
+-	int opts = 0;
+-	/* If we support any options, parse argv */
+-#if ENABLE_SELINUX || ENABLE_FEATURE_SHOW_THREADS || ENABLE_FEATURE_PS_WIDE
+-# if ENABLE_FEATURE_PS_WIDE
+-	/* -w is a bit complicated */
+-	int w_count = 0;
+-	opt_complementary = "-:ww";
+-	opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")"w", &w_count);
+-	/* if w is given once, GNU ps sets the width to 132,
+-	 * if w is given more than once, it is "unlimited"
+-	 */
+-	if (w_count) {
+-		terminal_width = (w_count == 1) ? 132 : MAX_WIDTH;
+-	} else {
+-		get_terminal_width_height(0, &terminal_width, NULL);
+-		/* Go one less... */
+-		if (--terminal_width > MAX_WIDTH)
+-			terminal_width = MAX_WIDTH;
+-	}
+-# else
+-	/* -w is not supported, only -Z and/or -T */
+-	opt_complementary = "-";
+-	opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T"));
+-# endif
+-#endif
+-
+-#if ENABLE_SELINUX
+-	if ((opts & OPT_Z) && is_selinux_enabled()) {
+-		psscan_flags = PSSCAN_PID | PSSCAN_CONTEXT
+-				| PSSCAN_STATE | PSSCAN_COMM;
+-		puts("  PID CONTEXT                          STAT COMMAND");
+-	} else
+-#endif
+-	{
+-		puts("  PID USER       VSZ STAT COMMAND");
+-	}
+-	if (opts & OPT_T) {
+-		psscan_flags |= PSSCAN_TASKS;
+-	}
+-
+-	p = NULL;
+-	while ((p = procps_scan(p, psscan_flags)) != NULL) {
+-		int len;
+-#if ENABLE_SELINUX
+-		if (psscan_flags & PSSCAN_CONTEXT) {
+-			len = printf("%5u %-32.32s %s  ",
+-					p->pid,
+-					p->context ? p->context : "unknown",
+-					p->state);
+-		} else
+-#endif
+-		{
+-			const char *user = get_cached_username(p->uid);
+-			//if (p->vsz == 0)
+-			//	len = printf("%5u %-8.8s        %s ",
+-			//		p->pid, user, p->state);
+-			//else
+-			{
+-				char buf6[6];
+-				smart_ulltoa5(p->vsz, buf6, " mgtpezy");
+-				buf6[5] = '\0';
+-				len = printf("%5u %-8.8s %s %s  ",
+-					p->pid, user, buf6, p->state);
+-			}
+-		}
+-
+-		{
+-			int sz = terminal_width - len;
+-			char buf[sz + 1];
+-			read_cmdline(buf, sz, p->pid, p->comm);
+-			puts(buf);
+-		}
+-	}
+-	if (ENABLE_FEATURE_CLEAN_UP)
+-		clear_username_cache();
+-	return EXIT_SUCCESS;
+-}
+-
+-#endif /* !ENABLE_DESKTOP */