All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] Enabling busybox-less builds
@ 2010-03-22  9:34 Martyn Welch
  2010-03-22  9:34 ` [PATCH 01/12] commit 587374363efe3fbd07f6a3d25bfb11230ac012f9 Martyn Welch
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:34 UTC (permalink / raw)
  To: openembedded-devel

This patch series is my first attempt at providing a working busybox-less
build. I'd hoped to clean it up a bit more before posting this, but as hrw is
looking at this as well, I'll post it now for discussion.

To prototype this, we have created an alternative "busybox" package that,
rather than building a version of busybox, causes the build to depend on a
suite of other packages which provide the functionality provided in a standard
build by busybox. I'm sure this list isn't perfect, but it's working for us.

We had a bit of issue with the update-alternatives that we were using - it
seemed to need both of the alternatives in the same directory, hence some of
these patches moving the install location of apps around.

There is also a nasty cludge to provide the hwclock script that Marcin
identifed as a problem. I've been meaning to get the alternative busybox script
to provide this, but haven't got arround to it yet.

We also replaced ifupdown with the ubuntu version, it seems to be a little
different from the debian version and it resolved some issues for us.

Please let me know what you think,

Martyn

--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 01/12] commit 587374363efe3fbd07f6a3d25bfb11230ac012f9
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
@ 2010-03-22  9:34 ` Martyn Welch
  2010-03-22  9:51   ` Marcin Juszkiewicz
  2010-03-22  9:34 ` [PATCH 02/12] commit fac64459a3623afe4590bf1de9de826a79e0a8fe Martyn Welch
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:34 UTC (permalink / raw)
  To: openembedded-devel

Funky alt busybox

    This patch provides a mechanism to replace busybox buy defining a busybox package which actually just requires a set of other packages.

    To get it to be used rather than the standard busybox, define:

    PREFERRED_PROVIDER_busybox = "busybox-alt"
---

 recipes/busybox/busybox-alt_1.bb |  110 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 110 insertions(+), 0 deletions(-)

diff --git a/recipes/busybox/busybox-alt_1.bb b/recipes/busybox/busybox-alt_1.bb
new file mode 100644
index 0000000..218ff4c
--- /dev/null
+++ b/recipes/busybox/busybox-alt_1.bb
@@ -0,0 +1,110 @@
+DESCRIPTION = "A set of alternatives to busybox"
+
+ALLOW_EMPTY = "1"
+PACKAGES = "busybox"
+PACKAGE_ARCH = "all"
+
+PROVIDES = "busybox"
+DEFAULT_PREFERENCE = "1"
+
+RDEPENDS = "\
+  bash \
+  bc \
+  bind-utils \
+  binutils \
+  binutils-symlinks \
+  bzip2 \
+  console-tools \
+  coreutils \
+  cpio \
+  debianutils \
+  dhcp-client \
+  diffutils \
+  e2fsprogs \
+  e2fsprogs-fsck \
+  e2fsprogs-libs \
+  fbset \
+  findutils \
+  gawk \
+  grep \
+  gzip \
+  ifupdown \
+#  inetutils \
+  iproute2 \
+  iputils-ping \
+  iputils-ping6 \
+  iputils-arping \
+  less \
+  minicom \
+  mktemp \
+  module-init-tools \
+  ncurses \
+  netcat \
+  net-tools \
+  patch \
+  procps \
+  psmisc \
+  openrdate \
+  realpath \
+  sed \
+  start-stop-daemon \
+  syslog-ng \
+  sysvinit \
+  tar \
+  tftp-hpa \
+  time \
+  traceroute \
+  util-linux-ng \
+  unzip \
+  vim \
+  wget \
+"
+
+DEPENDS = "\
+  bash \
+  bc \
+  bind \
+  binutils \
+  bzip2 \
+  console-tools \
+  coreutils \
+  cpio \
+  debianutils \
+  dhcp \
+  diffutils \
+  e2fsprogs \
+  fbset \
+  findutils \
+  gawk \
+  grep \
+  gzip \
+  ifupdown \
+#  inetutils \
+  iproute2 \
+  iputils \
+  less \
+  minicom \
+  mktemp \
+  module-init-tools \
+  ncurses \
+  netcat \
+  net-tools \
+  patch \
+  procps \
+  psmisc \
+  openrdate \
+  realpath \
+  sed \
+  start-stop-daemon \
+  syslog-ng \
+  sysvinit \
+  tar \
+  tftp-hpa \
+  time \
+  traceroute \
+  util-linux-ng \
+  unzip \
+  vim \
+  wget \
+"
+


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 02/12] commit fac64459a3623afe4590bf1de9de826a79e0a8fe
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
  2010-03-22  9:34 ` [PATCH 01/12] commit 587374363efe3fbd07f6a3d25bfb11230ac012f9 Martyn Welch
@ 2010-03-22  9:34 ` Martyn Welch
  2010-03-22  9:34 ` [PATCH 03/12] commit fefdbcf87a306218d600666c86a99e72e5fdde35 Martyn Welch
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:34 UTC (permalink / raw)
  To: openembedded-devel

Add realpath

    Add realpath utility, this is needed when building without busybox.
---

 recipes/realpath/files/makefile.patch |   12 ++++++++++++
 recipes/realpath/realpath_1.10.bb     |   19 +++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/recipes/realpath/files/makefile.patch b/recipes/realpath/files/makefile.patch
new file mode 100644
index 0000000..d97ba59
--- /dev/null
+++ b/recipes/realpath/files/makefile.patch
@@ -0,0 +1,12 @@
+diff -urN realpath-1.10.orig/Makefile realpath-1.10/Makefile
+--- realpath-1.10.orig/Makefile	2009-07-28 16:04:11.000000000 +0100
++++ realpath-1.10/Makefile	2009-07-28 16:08:44.000000000 +0100
+@@ -3,7 +3,7 @@
+ # "@(#)realpath:$Id: Makefile,v 1.30 2006-05-07 19:41:41 robert Exp $"
+ #
+ 
+-VERSION	= $(shell dpkg-parsechangelog | sed -ne 's/^Version: *//p')
++#VERSION	= $(shell dpkg-parsechangelog | sed -ne 's/^Version: *//p')
+ 
+ CC	= gcc
+ CFLAGS	= -Wall -Wstrict-prototypes -Wmissing-prototypes -DVERSION='"$(VERSION)"' 
diff --git a/recipes/realpath/realpath_1.10.bb b/recipes/realpath/realpath_1.10.bb
new file mode 100644
index 0000000..911f987
--- /dev/null
+++ b/recipes/realpath/realpath_1.10.bb
@@ -0,0 +1,19 @@
+DESCRIPTION = "Debian's Realpath Utility"
+SECTION = "utility"
+PRIORITY = "optional"
+LICENSE = "GPL"
+#DEPENDS = "perl-native po4a-native"
+PR = "r0"
+
+SRC_URI = "${DEBIAN_MIRROR}/main/r/realpath/realpath_${PV}.tar.gz;name=realpath \
+	file://makefile.patch;patch=1"
+
+SRC_URI[realpath.md5sum] = "1f2b2bceaacadf79162a9cbb5956c3b6"
+SRC_URI[realpath.sha256sum] = "72199f9c11d1f9a36b3b9693988b558a167def6b88fa146ea6a7f7223f96c535"
+
+CFLAGS += "-DVERSION=${PV}"
+
+do_install () {
+	install -d ${D}${bindir}
+	install -p -m 0755 ${S}/realpath ${D}${bindir}
+}


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 03/12] commit fefdbcf87a306218d600666c86a99e72e5fdde35
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
  2010-03-22  9:34 ` [PATCH 01/12] commit 587374363efe3fbd07f6a3d25bfb11230ac012f9 Martyn Welch
  2010-03-22  9:34 ` [PATCH 02/12] commit fac64459a3623afe4590bf1de9de826a79e0a8fe Martyn Welch
@ 2010-03-22  9:34 ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 04/12] commit 1484faec83f86877d1fa8c267de035e0016e4386 Martyn Welch
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:34 UTC (permalink / raw)
  To: openembedded-devel

Add start-stop-daemon

    This is not needed if you are building with busybox, however it is required
    if attempting a busybox-less build.
---

 .../start-stop-daemon/files/start-stop-daemon.c    |  965 ++++++++++++++++++++
 .../start-stop-daemon/start-stop-daemon_1.9.18.bb  |   22 
 2 files changed, 987 insertions(+), 0 deletions(-)

diff --git a/recipes/start-stop-daemon/files/start-stop-daemon.c b/recipes/start-stop-daemon/files/start-stop-daemon.c
new file mode 100644
index 0000000..5800625
--- /dev/null
+++ b/recipes/start-stop-daemon/files/start-stop-daemon.c
@@ -0,0 +1,965 @@
+/*
+ * A rewrite of the original Debian's start-stop-daemon Perl script
+ * in C (faster - it is executed many times during system startup).
+ *
+ * Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
+ * public domain.  Based conceptually on start-stop-daemon.pl, by Ian
+ * Jackson <ijackson@gnu.ai.mit.edu>.  May be used and distributed
+ * freely for any purpose.  Changes by Christian Schwarz
+ * <schwarz@monet.m.isar.de>, to make output conform to the Debian
+ * Console Message Standard, also placed in public domain.  Minor
+ * changes by Klee Dienes <klee@debian.org>, also placed in the Public
+ * Domain.
+ *
+ * Changes by Ben Collins <bcollins@debian.org>, added --chuid, --background
+ * and --make-pidfile options, placed in public domain aswell.
+ *
+ * Port to OpenBSD by Sontri Tomo Huynh <huynh.29@osu.edu>
+ *                 and Andreas Schuldei <andreas@schuldei.org>
+ *
+ * Changes by Ian Jackson: added --retry (and associated rearrangements).
+ *
+ * Modified for Gentoo rc-scripts by Donny Davies <woodchip@gentoo.org>:
+ *   I removed the BSD/Hurd/OtherOS stuff, added #include <stddef.h>
+ *   and stuck in a #define VERSION "1.9.18".  Now it compiles without
+ *   the whole automake/config.h dance.
+ */
+
+#include <stddef.h>
+#define VERSION "1.9.18"
+
+#define MIN_POLL_INTERVAL 20000 /*us*/
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <pwd.h>
+#include <grp.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/termios.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <assert.h>
+#include <ctype.h>
+#include <error.h>
+
+static int testmode = 0;
+static int quietmode = 0;
+static int exitnodo = 1;
+static int start = 0;
+static int stop = 0;
+static int background = 0;
+static int mpidfile = 0;
+static int signal_nr = 15;
+static const char *signal_str = NULL;
+static int user_id = -1;
+static int runas_uid = -1;
+static int runas_gid = -1;
+static const char *userspec = NULL;
+static char *changeuser = NULL;
+static const char *changegroup = NULL;
+static char *changeroot = NULL;
+static const char *cmdname = NULL;
+static char *execname = NULL;
+static char *startas = NULL;
+static const char *pidfile = NULL;
+static char what_stop[1024];
+static const char *schedule_str = NULL;
+static const char *progname = "";
+static int nicelevel = 0;
+
+static struct stat exec_stat;
+
+struct pid_list {
+	struct pid_list *next;
+	pid_t pid;
+};
+
+static struct pid_list *found = NULL;
+static struct pid_list *killed = NULL;
+
+struct schedule_item {
+	enum { sched_timeout, sched_signal, sched_goto, sched_forever } type;
+	int value; /* seconds, signal no., or index into array */
+	/* sched_forever is only seen within parse_schedule and callees */
+};
+
+static int schedule_length;
+static struct schedule_item *schedule = NULL;
+
+static void *xmalloc(int size);
+static void push(struct pid_list **list, pid_t pid);
+static void do_help(void);
+static void parse_options(int argc, char * const *argv);
+static int pid_is_user(pid_t pid, uid_t uid);
+static int pid_is_cmd(pid_t pid, const char *name);
+static void check(pid_t pid);
+static void do_pidfile(const char *name);
+static void do_stop(int signal_nr, int quietmode,
+		    int *n_killed, int *n_notkilled, int retry_nr);
+static int pid_is_exec(pid_t pid, const struct stat *esb);
+
+#ifdef __GNUC__
+static void fatal(const char *format, ...)
+	__attribute__((noreturn, format(printf, 1, 2)));
+static void badusage(const char *msg)
+	__attribute__((noreturn));
+#else
+static void fatal(const char *format, ...);
+static void badusage(const char *msg);
+#endif
+
+/* This next part serves only to construct the TVCALC macro, which
+ * is used for doing arithmetic on struct timeval's.  It works like this:
+ *   TVCALC(result, expression);
+ * where result is a struct timeval (and must be an lvalue) and
+ * expression is the single expression for both components.  In this
+ * expression you can use the special values TVELEM, which when fed a
+ * const struct timeval* gives you the relevant component, and
+ * TVADJUST.  TVADJUST is necessary when subtracting timevals, to make
+ * it easier to renormalise.  Whenver you subtract timeval elements,
+ * you must make sure that TVADJUST is added to the result of the
+ * subtraction (before any resulting multiplication or what have you).
+ * TVELEM must be linear in TVADJUST.
+ */
+typedef long tvselector(const struct timeval*);
+static long tvselector_sec(const struct timeval *tv) { return tv->tv_sec; }
+static long tvselector_usec(const struct timeval *tv) { return tv->tv_usec; }
+#define TVCALC_ELEM(result, expr, sec, adj)                           \
+{								      \
+  const long TVADJUST = adj;					      \
+  long (*const TVELEM)(const struct timeval*) = tvselector_##sec;     \
+  (result).tv_##sec = (expr);					      \
+}
+#define TVCALC(result,expr)					      \
+do {								      \
+  TVCALC_ELEM(result, expr, sec, (-1));				      \
+  TVCALC_ELEM(result, expr, usec, (+1000000));			      \
+  (result).tv_sec += (result).tv_usec / 1000000;		      \
+  (result).tv_usec %= 1000000;					      \
+} while(0)
+
+
+static void
+fatal(const char *format, ...)
+{
+	va_list arglist;
+
+	fprintf(stderr, "%s: ", progname);
+	va_start(arglist, format);
+	vfprintf(stderr, format, arglist);
+	va_end(arglist);
+	putc('\n', stderr);
+	exit(2);
+}
+
+
+static void *
+xmalloc(int size)
+{
+	void *ptr;
+
+	ptr = malloc(size);
+	if (ptr)
+		return ptr;
+	fatal("malloc(%d) failed", size);
+}
+
+
+static void
+xgettimeofday(struct timeval *tv)
+{
+	if (gettimeofday(tv,0) != 0)
+		fatal("gettimeofday failed: %s", strerror(errno));
+}
+
+
+static void
+push(struct pid_list **list, pid_t pid)
+{
+	struct pid_list *p;
+
+	p = xmalloc(sizeof(*p));
+	p->next = *list;
+	p->pid = pid;
+	*list = p;
+}
+
+static void
+clear(struct pid_list **list)
+{
+	struct pid_list *here, *next;
+
+	for (here = *list; here != NULL; here = next) {
+		next = here->next;
+		free(here);
+	}
+
+	*list = NULL;
+}
+
+static void
+do_help(void)
+{
+	printf(
+"start-stop-daemon " VERSION " for Debian - small and fast C version written by\n"
+"Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, public domain.\n"
+"\n"
+"Usage:\n"
+"  start-stop-daemon -S|--start options ... -- arguments ...\n"
+"  start-stop-daemon -K|--stop options ...\n"
+"  start-stop-daemon -H|--help\n"
+"  start-stop-daemon -V|--version\n"
+"\n"
+"Options (at least one of --exec|--pidfile|--user is required):\n"
+"  -x|--exec <executable>        program to start/check if it is running\n"
+"  -p|--pidfile <pid-file>       pid file to check\n"
+"  -c|--chuid <name|uid[:group|gid]>\n"
+"  		change to this user/group before starting process\n"
+"  -u|--user <username>|<uid>    stop processes owned by this user\n"
+"  -n|--name <process-name>      stop processes with this name\n"
+"  -s|--signal <signal>          signal to send (default TERM)\n"
+"  -a|--startas <pathname>       program to start (default is <executable>)\n"
+"  -N|--nicelevel <incr>         add incr to the process's nice level\n"
+"  -b|--background               force the process to detach\n"
+"  -m|--make-pidfile             create the pidfile before starting\n"
+"  -R|--retry <schedule>         check whether processes die, and retry\n"
+"  -t|--test                     test mode, don't do anything\n"
+"  -o|--oknodo                   exit status 0 (not 1) if nothing done\n"
+"  -q|--quiet                    be more quiet\n"
+"  -v|--verbose                  be more verbose\n"
+"Retry <schedule> is <item>|/<item>/... where <item> is one of\n"
+" -<signal-num>|[-]<signal-name>  send that signal\n"
+" <timeout>                       wait that many seconds\n"
+" forever                         repeat remainder forever\n"
+"or <schedule> may be just <timeout>, meaning <signal>/<timeout>/KILL/<timeout>\n"
+"\n"
+"Exit status:  0 = done      1 = nothing done (=> 0 if --oknodo)\n"
+"              3 = trouble   2 = with --retry, processes wouldn't die\n");
+}
+
+
+static void
+badusage(const char *msg)
+{
+	if (msg)
+		fprintf(stderr, "%s: %s\n", progname, msg);
+	fprintf(stderr, "Try `%s --help' for more information.\n", progname);
+	exit(3);
+}
+
+struct sigpair {
+	const char *name;
+	int signal;
+};
+
+const struct sigpair siglist[] = {
+	{ "ABRT",	SIGABRT	},
+	{ "ALRM",	SIGALRM	},
+	{ "FPE",	SIGFPE	},
+	{ "HUP",	SIGHUP	},
+	{ "ILL",	SIGILL	},
+	{ "INT",	SIGINT	},
+	{ "KILL",	SIGKILL	},
+	{ "PIPE",	SIGPIPE	},
+	{ "QUIT",	SIGQUIT	},
+	{ "SEGV",	SIGSEGV	},
+	{ "TERM",	SIGTERM	},
+	{ "USR1",	SIGUSR1	},
+	{ "USR2",	SIGUSR2	},
+	{ "CHLD",	SIGCHLD	},
+	{ "CONT",	SIGCONT	},
+	{ "STOP",	SIGSTOP	},
+	{ "TSTP",	SIGTSTP	},
+	{ "TTIN",	SIGTTIN	},
+	{ "TTOU",	SIGTTOU	}
+};
+
+static int parse_integer (const char *string, int *value_r) {
+	unsigned long ul;
+	char *ep;
+
+	if (!string[0])
+		return -1;
+
+	ul= strtoul(string,&ep,10);
+	if (ul > INT_MAX || *ep != '\0')
+		return -1;
+
+	*value_r= ul;
+	return 0;
+}
+
+static int parse_signal (const char *signal_str, int *signal_nr)
+{
+	unsigned int i;
+
+	if (parse_integer(signal_str, signal_nr) == 0)
+		return 0;
+
+	for (i = 0; i < sizeof (siglist) / sizeof (siglist[0]); i++) {
+		if (strcmp (signal_str, siglist[i].name) == 0) {
+			*signal_nr = siglist[i].signal;
+			return 0;
+		}
+	}
+	return -1;
+}
+
+static void
+parse_schedule_item(const char *string, struct schedule_item *item) {
+	const char *after_hyph;
+
+	if (!strcmp(string,"forever")) {
+		item->type = sched_forever;
+	} else if (isdigit(string[0])) {
+		item->type = sched_timeout;
+		if (parse_integer(string, &item->value) != 0)
+			badusage("invalid timeout value in schedule");
+	} else if ((after_hyph = string + (string[0] == '-')) &&
+		   parse_signal(after_hyph, &item->value) == 0) {
+		item->type = sched_signal;
+	} else {
+		badusage("invalid schedule item (must be [-]<signal-name>, "
+			 "-<signal-number>, <timeout> or `forever'");
+	}
+}
+
+static void
+parse_schedule(const char *schedule_str) {
+	char item_buf[20];
+	const char *slash;
+	int count, repeatat;
+	ptrdiff_t str_len;
+
+	count = 0;
+	for (slash = schedule_str; *slash; slash++)
+		if (*slash == '/')
+			count++;
+
+	schedule_length = (count == 0) ? 4 : count+1;
+	schedule = xmalloc(sizeof(*schedule) * schedule_length);
+
+	if (count == 0) {
+		schedule[0].type = sched_signal;
+		schedule[0].value = signal_nr;
+		parse_schedule_item(schedule_str, &schedule[1]);
+		if (schedule[1].type != sched_timeout) {
+			badusage ("--retry takes timeout, or schedule list"
+				  " of at least two items");
+		}
+		schedule[2].type = sched_signal;
+		schedule[2].value = SIGKILL;
+		schedule[3]= schedule[1];
+	} else {
+		count = 0;
+		repeatat = -1;
+		while (schedule_str != NULL) {
+			slash = strchr(schedule_str,'/');
+			str_len = slash ? slash - schedule_str : strlen(schedule_str);
+			if (str_len >= (ptrdiff_t)sizeof(item_buf))
+				badusage("invalid schedule item: far too long"
+					 " (you must delimit items with slashes)");
+			memcpy(item_buf, schedule_str, str_len);
+			item_buf[str_len] = 0;
+			schedule_str = slash ? slash+1 : NULL;
+
+			parse_schedule_item(item_buf, &schedule[count]);
+			if (schedule[count].type == sched_forever) {
+				if (repeatat >= 0)
+					badusage("invalid schedule: `forever'"
+						 " appears more than once");
+				repeatat = count;
+				continue;
+			}
+			count++;
+		}
+		if (repeatat >= 0) {
+			schedule[count].type = sched_goto;
+			schedule[count].value = repeatat;
+			count++;
+		}
+		assert(count == schedule_length);
+	}
+}
+
+static void
+parse_options(int argc, char * const *argv)
+{
+	static struct option longopts[] = {
+		{ "help",	  0, NULL, 'H'},
+		{ "stop",	  0, NULL, 'K'},
+		{ "start",	  0, NULL, 'S'},
+		{ "version",	  0, NULL, 'V'},
+		{ "startas",	  1, NULL, 'a'},
+		{ "name",	  1, NULL, 'n'},
+		{ "oknodo",	  0, NULL, 'o'},
+		{ "pidfile",	  1, NULL, 'p'},
+		{ "quiet",	  0, NULL, 'q'},
+		{ "signal",	  1, NULL, 's'},
+		{ "test",	  0, NULL, 't'},
+		{ "user",	  1, NULL, 'u'},
+		{ "chroot",	  1, NULL, 'r'},
+		{ "verbose",	  0, NULL, 'v'},
+		{ "exec",	  1, NULL, 'x'},
+		{ "chuid",	  1, NULL, 'c'},
+		{ "nicelevel",	  1, NULL, 'N'},
+		{ "background",   0, NULL, 'b'},
+		{ "make-pidfile", 0, NULL, 'm'},
+ 		{ "retry",        1, NULL, 'R'},
+		{ NULL,		0, NULL, 0}
+	};
+	int c;
+
+	for (;;) {
+		c = getopt_long(argc, argv, "HKSVa:n:op:qr:s:tu:vx:c:N:bmR:",
+				longopts, (int *) 0);
+		if (c == -1)
+			break;
+		switch (c) {
+		case 'H':  /* --help */
+			do_help();
+			exit(0);
+		case 'K':  /* --stop */
+			stop = 1;
+			break;
+		case 'S':  /* --start */
+			start = 1;
+			break;
+		case 'V':  /* --version */
+			printf("start-stop-daemon " VERSION "\n");
+			exit(0);
+		case 'a':  /* --startas <pathname> */
+			startas = optarg;
+			break;
+		case 'n':  /* --name <process-name> */
+			cmdname = optarg;
+			break;
+		case 'o':  /* --oknodo */
+			exitnodo = 0;
+			break;
+		case 'p':  /* --pidfile <pid-file> */
+			pidfile = optarg;
+			break;
+		case 'q':  /* --quiet */
+			quietmode = 1;
+			break;
+		case 's':  /* --signal <signal> */
+			signal_str = optarg;
+			break;
+		case 't':  /* --test */
+			testmode = 1;
+			break;
+		case 'u':  /* --user <username>|<uid> */
+			userspec = optarg;
+			break;
+		case 'v':  /* --verbose */
+			quietmode = -1;
+			break;
+		case 'x':  /* --exec <executable> */
+			execname = optarg;
+			break;
+		case 'c':  /* --chuid <username>|<uid> */
+			/* we copy the string just in case we need the
+			 * argument later. */
+			changeuser = strdup(optarg);
+			changeuser = strtok(changeuser, ":");
+			changegroup = strtok(NULL, ":");
+			break;
+		case 'r':  /* --chroot /new/root */
+			changeroot = optarg;
+			break;
+		case 'N':  /* --nice */
+			nicelevel = atoi(optarg);
+			break;
+		case 'b':  /* --background */
+			background = 1;
+			break;
+		case 'm':  /* --make-pidfile */
+			mpidfile = 1;
+			break;
+		case 'R':  /* --retry <schedule>|<timeout> */
+			schedule_str = optarg;
+			break;
+		default:
+			badusage(NULL);  /* message printed by getopt */
+		}
+	}
+
+	if (signal_str != NULL) {
+		if (parse_signal (signal_str, &signal_nr) != 0)
+			badusage("signal value must be numeric or name"
+				 " of signal (KILL, INTR, ...)");
+	}
+
+	if (schedule_str != NULL) {
+		parse_schedule(schedule_str);
+	}
+
+	if (start == stop)
+		badusage("need one of --start or --stop");
+
+	if (!execname && !pidfile && !userspec && !cmdname)
+		badusage("need at least one of --exec, --pidfile, --user or --name");
+
+	if (!startas)
+		startas = execname;
+
+	if (start && !startas)
+		badusage("--start needs --exec or --startas");
+
+	if (mpidfile && pidfile == NULL)
+		badusage("--make-pidfile is only relevant with --pidfile");
+
+	if (background && !start)
+		badusage("--background is only relevant with --start");
+
+}
+
+static int
+pid_is_exec(pid_t pid, const struct stat *esb)
+{
+	struct stat sb;
+	char buf[32];
+
+	sprintf(buf, "/proc/%d/exe", pid);
+	if (stat(buf, &sb) != 0)
+		return 0;
+	return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino);
+}
+
+
+static int
+pid_is_user(pid_t pid, uid_t uid)
+{
+	struct stat sb;
+	char buf[32];
+
+	sprintf(buf, "/proc/%d", pid);
+	if (stat(buf, &sb) != 0)
+		return 0;
+	return (sb.st_uid == uid);
+}
+
+
+static int
+pid_is_cmd(pid_t pid, const char *name)
+{
+	char buf[32];
+	FILE *f;
+	int c;
+
+	sprintf(buf, "/proc/%d/stat", pid);
+	f = fopen(buf, "r");
+	if (!f)
+		return 0;
+	while ((c = getc(f)) != EOF && c != '(')
+		;
+	if (c != '(') {
+		fclose(f);
+		return 0;
+	}
+	/* this hopefully handles command names containing ')' */
+	while ((c = getc(f)) != EOF && c == *name)
+		name++;
+	fclose(f);
+	return (c == ')' && *name == '\0');
+}
+
+
+static void
+check(pid_t pid)
+{
+	if (execname && !pid_is_exec(pid, &exec_stat))
+		return;
+	if (userspec && !pid_is_user(pid, user_id))
+		return;
+	if (cmdname && !pid_is_cmd(pid, cmdname))
+		return;
+	push(&found, pid);
+}
+
+static void
+do_pidfile(const char *name)
+{
+	FILE *f;
+	pid_t pid;
+
+	f = fopen(name, "r");
+	if (f) {
+		if (fscanf(f, "%d", &pid) == 1)
+			check(pid);
+		fclose(f);
+	} else if (errno != ENOENT)
+		fatal("open pidfile %s: %s", name, strerror(errno));
+
+}
+
+/* WTA: this  needs to be an autoconf check for /proc/pid existance.
+ */
+static void
+do_procinit(void)
+{
+	DIR *procdir;
+	struct dirent *entry;
+	int foundany;
+	pid_t pid;
+
+	procdir = opendir("/proc");
+	if (!procdir)
+		fatal("opendir /proc: %s", strerror(errno));
+
+	foundany = 0;
+	while ((entry = readdir(procdir)) != NULL) {
+		if (sscanf(entry->d_name, "%d", &pid) != 1)
+			continue;
+		foundany++;
+		check(pid);
+	}
+	closedir(procdir);
+	if (!foundany)
+		fatal("nothing in /proc - not mounted?");
+}
+
+static void
+do_findprocs(void)
+{
+	clear(&found);
+	
+	if (pidfile)
+		do_pidfile(pidfile);
+	else
+		do_procinit();
+}
+
+/* return 1 on failure */
+static void
+do_stop(int signal_nr, int quietmode, int *n_killed, int *n_notkilled, int retry_nr)
+{
+	struct pid_list *p;
+
+ 	do_findprocs();
+ 
+ 	*n_killed = 0;
+ 	*n_notkilled = 0;
+ 
+ 	if (!found)
+ 		return;
+ 
+ 	clear(&killed);
+
+	for (p = found; p; p = p->next) {
+		if (testmode)
+			printf("Would send signal %d to %d.\n",
+			       signal_nr, p->pid);
+ 		else if (kill(p->pid, signal_nr) == 0) {
+			push(&killed, p->pid);
+ 			(*n_killed)++;
+		} else {
+			printf("%s: warning: failed to kill %d: %s\n",
+			       progname, p->pid, strerror(errno));
+ 			(*n_notkilled)++;
+		}
+	}
+	if (quietmode < 0 && killed) {
+ 		printf("Stopped %s (pid", what_stop);
+		for (p = killed; p; p = p->next)
+			printf(" %d", p->pid);
+ 		putchar(')');
+ 		if (retry_nr > 0)
+ 			printf(", retry #%d", retry_nr);
+ 		printf(".\n");
+	}
+}
+
+
+static void
+set_what_stop(const char *str)
+{
+	strncpy(what_stop, str, sizeof(what_stop));
+	what_stop[sizeof(what_stop)-1] = '\0';
+}
+
+static int
+run_stop_schedule(void)
+{
+	int r, position, n_killed, n_notkilled, value, ratio, anykilled, retry_nr;
+	struct timeval stopat, before, after, interval, maxinterval;
+
+	if (testmode) {
+		if (schedule != NULL) {
+			printf("Ignoring --retry in test mode\n");
+			schedule = NULL;
+		}
+	}
+
+	if (cmdname)
+		set_what_stop(cmdname);
+	else if (execname)
+		set_what_stop(execname);
+	else if (pidfile)
+		sprintf(what_stop, "process in pidfile `%.200s'", pidfile);
+	else if (userspec)
+		sprintf(what_stop, "process(es) owned by `%.200s'", userspec);
+	else
+		fatal("internal error, please report");
+
+	anykilled = 0;
+	retry_nr = 0;
+
+	if (schedule == NULL) {
+		do_stop(signal_nr, quietmode, &n_killed, &n_notkilled, 0);
+		if (n_notkilled > 0 && quietmode <= 0)
+			printf("%d pids were not killed\n", n_notkilled);
+		if (n_killed)
+			anykilled = 1;
+		goto x_finished;
+	}
+
+	for (position = 0; position < schedule_length; ) {
+		value= schedule[position].value;
+		n_notkilled = 0;
+
+		switch (schedule[position].type) {
+
+		case sched_goto:
+			position = value;
+			continue;
+
+		case sched_signal:
+			do_stop(value, quietmode, &n_killed, &n_notkilled, retry_nr++);
+			if (!n_killed)
+				goto x_finished;
+			else
+				anykilled = 1;
+			goto next_item;
+
+		case sched_timeout:
+ /* We want to keep polling for the processes, to see if they've exited,
+  * or until the timeout expires.
+  *
+  * This is a somewhat complicated algorithm to try to ensure that we
+  * notice reasonably quickly when all the processes have exited, but
+  * don't spend too much CPU time polling.  In particular, on a fast
+  * machine with quick-exiting daemons we don't want to delay system
+  * shutdown too much, whereas on a slow one, or where processes are
+  * taking some time to exit, we want to increase the polling
+  * interval.
+  *
+  * The algorithm is as follows: we measure the elapsed time it takes
+  * to do one poll(), and wait a multiple of this time for the next
+  * poll.  However, if that would put us past the end of the timeout
+  * period we wait only as long as the timeout period, but in any case
+  * we always wait at least MIN_POLL_INTERVAL (20ms).  The multiple
+  * (`ratio') starts out as 2, and increases by 1 for each poll to a
+  * maximum of 10; so we use up to between 30% and 10% of the
+  * machine's resources (assuming a few reasonable things about system
+  * performance).
+  */
+			xgettimeofday(&stopat);
+			stopat.tv_sec += value;
+			ratio = 1;
+			for (;;) {
+				xgettimeofday(&before);
+				if (timercmp(&before,&stopat,>))
+					goto next_item;
+
+				do_stop(0, 1, &n_killed, &n_notkilled, 0);
+				if (!n_killed)
+					goto x_finished;
+
+				xgettimeofday(&after);
+
+				if (!timercmp(&after,&stopat,<))
+					goto next_item;
+
+				if (ratio < 10)
+					ratio++;
+
+ TVCALC(interval,    ratio * (TVELEM(&after) - TVELEM(&before) + TVADJUST));
+ TVCALC(maxinterval,          TVELEM(&stopat) - TVELEM(&after) + TVADJUST);
+
+				if (timercmp(&interval,&maxinterval,>))
+					interval = maxinterval;
+
+				if (interval.tv_sec == 0 &&
+				    interval.tv_usec <= MIN_POLL_INTERVAL)
+				        interval.tv_usec = MIN_POLL_INTERVAL;
+
+				r = select(0,0,0,0,&interval);
+				if (r < 0 && errno != EINTR)
+					fatal("select() failed for pause: %s",
+					      strerror(errno));
+			}
+
+		default:
+			assert(!"schedule[].type value must be valid");
+
+		}
+
+	next_item:
+		position++;
+	}
+
+	if (quietmode <= 0)
+		printf("Program %s, %d process(es), refused to die.\n",
+		       what_stop, n_killed);
+
+	return 2;
+
+x_finished:
+	if (!anykilled) {
+		if (quietmode <= 0)
+			printf("No %s found running; none killed.\n", what_stop);
+		return exitnodo;
+	} else {
+		return 0;
+	}
+}
+
+/*
+int main(int argc, char **argv) NONRETURNING;
+*/
+
+int
+main(int argc, char **argv)
+{
+	progname = argv[0];
+
+	parse_options(argc, argv);
+	argc -= optind;
+	argv += optind;
+
+	if (execname && stat(execname, &exec_stat))
+		fatal("stat %s: %s", execname, strerror(errno));
+
+	if (userspec && sscanf(userspec, "%d", &user_id) != 1) {
+		struct passwd *pw;
+
+		pw = getpwnam(userspec);
+		if (!pw)
+			fatal("user `%s' not found\n", userspec);
+
+		user_id = pw->pw_uid;
+	}
+
+	if (changegroup && sscanf(changegroup, "%d", &runas_gid) != 1) {
+		struct group *gr = getgrnam(changegroup);
+		if (!gr)
+			fatal("group `%s' not found\n", changegroup);
+		runas_gid = gr->gr_gid;
+	}
+	if (changeuser && sscanf(changeuser, "%d", &runas_uid) != 1) {
+		struct passwd *pw = getpwnam(changeuser);
+		if (!pw)
+			fatal("user `%s' not found\n", changeuser);
+		runas_uid = pw->pw_uid;
+		if (changegroup == NULL) { /* pass the default group of this user */
+			changegroup = ""; /* just empty */
+			runas_gid = pw->pw_gid;
+		}
+	}
+
+	if (stop) {
+		int i = run_stop_schedule();
+		exit(i);
+	}
+
+	do_findprocs();
+
+	if (found) {
+		if (quietmode <= 0)
+			printf("%s already running.\n", execname);
+		exit(exitnodo);
+	}
+	if (testmode) {
+		printf("Would start %s ", startas);
+		while (argc-- > 0)
+			printf("%s ", *argv++);
+		if (changeuser != NULL) {
+			printf(" (as user %s[%d]", changeuser, runas_uid);
+			if (changegroup != NULL)
+				printf(", and group %s[%d])", changegroup, runas_gid);
+			else
+				printf(")");
+		}
+		if (changeroot != NULL)
+			printf(" in directory %s", changeroot);
+		if (nicelevel)
+			printf(", and add %i to the priority", nicelevel);
+		printf(".\n");
+		exit(0);
+	}
+	if (quietmode < 0)
+		printf("Starting %s...\n", startas);
+	*--argv = startas;
+	if (changeroot != NULL) {
+		if (chdir(changeroot) < 0)
+			fatal("Unable to chdir() to %s", changeroot);
+		if (chroot(changeroot) < 0)
+			fatal("Unable to chroot() to %s", changeroot);
+	}
+	if (changeuser != NULL) {
+ 		if (setgid(runas_gid))
+ 			fatal("Unable to set gid to %d", runas_gid);
+		if (initgroups(changeuser, runas_gid))
+			fatal("Unable to set initgroups() with gid %d", runas_gid);
+		if (setuid(runas_uid))
+			fatal("Unable to set uid to %s", changeuser);
+	}
+
+	if (background) { /* ok, we need to detach this process */
+		int i, fd;
+		if (quietmode < 0)
+			printf("Detatching to start %s...", startas);
+		i = fork();
+		if (i<0) {
+			fatal("Unable to fork.\n");
+		}
+		if (i) { /* parent */
+			if (quietmode < 0)
+				printf("done.\n");
+			exit(0);
+		}
+		 /* child continues here */
+		 /* now close all extra fds */
+		for (i=getdtablesize()-1; i>=0; --i) close(i);
+		 /* change tty */
+		fd = open("/dev/tty", O_RDWR);
+		ioctl(fd, TIOCNOTTY, 0);
+		close(fd);
+		chdir("/");
+		umask(022); /* set a default for dumb programs */
+		setpgid(0,0);  /* set the process group */
+		fd=open("/dev/null", O_RDWR); /* stdin */
+		dup(fd); /* stdout */
+		dup(fd); /* stderr */
+	}
+	if (nicelevel) {
+		errno = 0;
+		if (nice(nicelevel) < 0 && errno)
+			fatal("Unable to alter nice level by %i: %s", nicelevel,
+				strerror(errno));
+	}
+	if (mpidfile && pidfile != NULL) { /* user wants _us_ to make the pidfile :) */
+		FILE *pidf = fopen(pidfile, "w");
+		pid_t pidt = getpid();
+		if (pidf == NULL)
+			fatal("Unable to open pidfile `%s' for writing: %s", pidfile,
+				strerror(errno));
+		fprintf(pidf, "%d\n", pidt);
+		fclose(pidf);
+	}
+	execv(startas, argv);
+	fatal("Unable to start %s: %s", startas, strerror(errno));
+}
+
diff --git a/recipes/start-stop-daemon/start-stop-daemon_1.9.18.bb b/recipes/start-stop-daemon/start-stop-daemon_1.9.18.bb
new file mode 100644
index 0000000..1591b09
--- /dev/null
+++ b/recipes/start-stop-daemon/start-stop-daemon_1.9.18.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "Debian's start-stop-daemon utility"
+SECTION = "base"
+PRIORITY = "optional"
+LICENSE = "PD"
+PR = "r0"
+
+SRC_URI = "file://start-stop-daemon.c"
+
+S = "${WORKDIR}"
+
+do_configure() {
+	:
+}
+
+do_compile() {
+	${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/start-stop-daemon.c -o start-stop-daemon
+}
+
+do_install () {
+	install -d ${D}/${base_sbindir}
+	install -m 0755 ${S}/start-stop-daemon ${D}/${base_sbindir}/start-stop-daemon
+}


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 04/12] commit 1484faec83f86877d1fa8c267de035e0016e4386
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (2 preceding siblings ...)
  2010-03-22  9:34 ` [PATCH 03/12] commit fefdbcf87a306218d600666c86a99e72e5fdde35 Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 05/12] Add alternatives to patch Martyn Welch
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

Add traceroute application

    This is provided by busybox, but the full version is required if building
    without busybox.
---

 recipes/traceroute/traceroute_2.0.12.bb |   32 +++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/recipes/traceroute/traceroute_2.0.12.bb b/recipes/traceroute/traceroute_2.0.12.bb
new file mode 100644
index 0000000..04678a6
--- /dev/null
+++ b/recipes/traceroute/traceroute_2.0.12.bb
@@ -0,0 +1,32 @@
+DESCRIPTION = "GNU traceroute"
+HOMEPAGE = "http://traceroute.sourceforge.net"
+SECTION = "network"
+LICENSE = "GPLv2"
+PR = "r1"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/traceroute/traceroute-${PV}.tar.gz;name=traceroute"
+
+SRC_URI[traceroute.md5sum] = "2262a9d30ae85f12b759a38ef827f8f7"
+SRC_URI[traceroute.sha256sum] = "d9609699982ac500cf361a34bd0685a1e5d71d001b6087e4eb68236048ff078f"
+
+do_compile() {
+	rm -rf ${S}/patches
+	export LDFLAGS="${TARGET_LDFLAGS} -L${S}/libsupp"
+	oe_runmake "env=yes"
+}
+
+do_install() {
+	install -d ${D}${bindir}
+	install -m 755 ${S}/traceroute/traceroute ${D}${bindir}
+	mv ${D}${bindir}/traceroute ${D}${bindir}/traceroute.${PN}
+}
+
+pkg_postinst() {
+	update-alternatives --install ${bindir}/traceroute traceroute ${bindir}/traceroute.${PN} 100
+	update-alternatives --install ${bindir}/traceroute6 traceroute6 ${bindir}/traceroute.${PN} 100
+}
+
+pkg_postrm() {
+	update-alternatives --remove traceroute ${bindir}/traceroute.${PN}
+	update-alternatives --remove traceroute6 ${bindir}/traceroute.${PN}
+}


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 05/12] Add alternatives to patch
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (3 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 04/12] commit 1484faec83f86877d1fa8c267de035e0016e4386 Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-22  9:53   ` Marcin Juszkiewicz
  2010-03-22  9:35 ` [PATCH 06/12] Modify location of busybox applets Martyn Welch
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

This adds an alternatives link for /bin/sh to the bash package. When
installed this will make bash overide the busybox provided shell for
"/bin/sh". This may or may not be desirable, but including it does allow an
image to be provided without busybox.
---

 recipes/bash/bash.inc    |    6 +++++-
 recipes/bash/bash_3.0.bb |    2 +-
 recipes/bash/bash_3.2.bb |    2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/recipes/bash/bash.inc b/recipes/bash/bash.inc
index 4eba689..a4658cf 100644
--- a/recipes/bash/bash.inc
+++ b/recipes/bash/bash.inc
@@ -4,7 +4,7 @@ DEPENDS = "ncurses"
 SECTION = "base/shell"
 LICENSE = "GPL"
 
-inherit autotools gettext
+inherit autotools gettext update-alternatives
 
 PARALLEL_MAKE = ""
 
@@ -33,3 +33,7 @@ pkg_postinst () {
 	grep -q "bin/bash" $D${sysconfdir}/shells || echo /bin/bash >> $D${sysconfdir}/shells
 	grep -q "bin/sh" $D${sysconfdir}/shells || echo /bin/sh >> $D${sysconfdir}/shells
 }
+ALTERNATIVE_NAME = "sh"
+ALTERNATIVE_LINK = "${base_bindir}/sh"
+ALTERNATIVE_PATH = "${base_bindir}/bash"
+ALTERNATIVE_PRIORITY = "100"
diff --git a/recipes/bash/bash_3.0.bb b/recipes/bash/bash_3.0.bb
index 8165d07..ccf0079 100644
--- a/recipes/bash/bash_3.0.bb
+++ b/recipes/bash/bash_3.0.bb
@@ -1,5 +1,5 @@
 require bash.inc
-PR = "r12"
+PR = "r13"
 
 SRC_URI += "\
   file://bash-3.0-fixes.patch;patch=1 \
diff --git a/recipes/bash/bash_3.2.bb b/recipes/bash/bash_3.2.bb
index e175467..867b42f 100644
--- a/recipes/bash/bash_3.2.bb
+++ b/recipes/bash/bash_3.2.bb
@@ -1,6 +1,6 @@
 require bash.inc
 
-PR = "r8"
+PR = "r9"
 
 SRC_URI += "\
            file://builtins.patch;patch=1 \


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 06/12] Modify location of busybox applets
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (4 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 05/12] Add alternatives to patch Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 07/12] Modify location of coreutils executables Martyn Welch
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

Modify where busybox puts it's applets so that they conform more to what we
believe to be their standard location.
---

 recipes/busybox/busybox_1.13.2.bb        |    1 +
 recipes/busybox/files/applets-path.patch |   58 ++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/recipes/busybox/busybox_1.13.2.bb b/recipes/busybox/busybox_1.13.2.bb
index d22819e..9945673 100644
--- a/recipes/busybox/busybox_1.13.2.bb
+++ b/recipes/busybox/busybox_1.13.2.bb
@@ -35,6 +35,7 @@ SRC_URI = "\
   file://defconfig \
   file://mdev \
   file://mdev.conf \
+  file://applets-path.patch;patch=1 \
 "
 SRC_URI[tarball.md5sum] = "9e2a604d18bef219a5a6bf3acf78b9e1"
 SRC_URI[tarball.sha256sum] = "927774408bd982dd246fb716bb2e646ab0708ce321b42c5e271dc98c1f5d1dc8"
diff --git a/recipes/busybox/files/applets-path.patch b/recipes/busybox/files/applets-path.patch
new file mode 100644
index 0000000..137781c
--- /dev/null
+++ b/recipes/busybox/files/applets-path.patch
@@ -0,0 +1,58 @@
+--- busybox-1.13.2-orig/include/applets.h	2009-08-16 05:08:58.528072682 +0100
++++ busybox-1.13.2/include/applets.h	2009-08-16 05:10:22.667618636 +0100
+@@ -89,7 +89,7 @@
+ USE_CAT(APPLET_NOFORK(cat, cat, _BB_DIR_BIN, _BB_SUID_NEVER, cat))
+ USE_CATV(APPLET(catv, _BB_DIR_BIN, _BB_SUID_NEVER))
+ USE_CHAT(APPLET(chat, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+-USE_CHATTR(APPLET(chattr, _BB_DIR_BIN, _BB_SUID_NEVER))
++USE_CHATTR(APPLET(chattr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_CHCON(APPLET(chcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_CHGRP(APPLET_NOEXEC(chgrp, chgrp, _BB_DIR_BIN, _BB_SUID_NEVER, chgrp))
+ USE_CHMOD(APPLET_NOEXEC(chmod, chmod, _BB_DIR_BIN, _BB_SUID_NEVER, chmod))
+@@ -165,7 +165,7 @@
+ USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpput))
+ USE_FUSER(APPLET(fuser, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_GETENFORCE(APPLET(getenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
+-USE_GETOPT(APPLET(getopt, _BB_DIR_BIN, _BB_SUID_NEVER))
++USE_GETOPT(APPLET(getopt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
+ USE_GETTY(APPLET(getty, _BB_DIR_SBIN, _BB_SUID_NEVER))
+ USE_GREP(APPLET(grep, _BB_DIR_BIN, _BB_SUID_NEVER))
+@@ -288,7 +288,7 @@
+ USE_PSCAN(APPLET(pscan, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd))
+ USE_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER))
+-USE_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
++USE_RDATE(APPLET(rdate, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_RDEV(APPLET(rdev, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
+ USE_READAHEAD(APPLET(readahead, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_READLINK(APPLET(readlink, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+@@ -307,8 +307,8 @@
+ USE_ROUTE(APPLET(route, _BB_DIR_SBIN, _BB_SUID_NEVER))
+ USE_RPM(APPLET(rpm, _BB_DIR_BIN, _BB_SUID_NEVER))
+ USE_RPM2CPIO(APPLET(rpm2cpio, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+-USE_RTCWAKE(APPLET(rtcwake, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+-USE_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts))
++USE_RTCWAKE(APPLET(rtcwake, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
++USE_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, _BB_DIR_USR_BIN, _BB_SUID_NEVER, run_parts))
+ USE_RUNCON(APPLET(runcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_RUNLEVEL(APPLET(runlevel, _BB_DIR_SBIN, _BB_SUID_NEVER))
+ USE_RUNSV(APPLET(runsv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+@@ -324,7 +324,7 @@
+ USE_SETCONSOLE(APPLET(setconsole, _BB_DIR_SBIN, _BB_SUID_NEVER))
+ USE_SETENFORCE(APPLET(setenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
+ USE_SETFILES(APPLET(setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER))
+-USE_SETFONT(APPLET(setfont, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
++USE_SETFONT(APPLET(setfont, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_SETKEYCODES(APPLET(setkeycodes, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_SETLOGCONS(APPLET(setlogcons, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
+ USE_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
+@@ -396,7 +396,7 @@
+ USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
+ USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
+ USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
+-USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
++USE_WATCH(APPLET(watch, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_WATCHDOG(APPLET(watchdog, _BB_DIR_SBIN, _BB_SUID_NEVER))
+ USE_WC(APPLET(wc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ USE_WGET(APPLET(wget, _BB_DIR_USR_BIN, _BB_SUID_NEVER))


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 07/12] Modify location of coreutils executables
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (5 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 06/12] Modify location of busybox applets Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 08/12] Modify location of debianutils executables Martyn Welch
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

Modify where the coreutils executables are put so that they conform more to
what we believe to be their standard location.
---

 recipes/coreutils/coreutils-target.inc |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/recipes/coreutils/coreutils-target.inc b/recipes/coreutils/coreutils-target.inc
index 1dd1d36..5bab4b2 100644
--- a/recipes/coreutils/coreutils-target.inc
+++ b/recipes/coreutils/coreutils-target.inc
@@ -2,17 +2,17 @@ EXTRA_AUTORECONF += "-I ${S}/m4"
 SRC_URI += "file://onceonly.m4"
 
 # [ gets a special treatment and is not included in this
-bindir_progs = "basename cksum comm csplit cut df dir dircolors dirname du \
+bindir_progs = "basename cksum comm csplit cut dir dircolors dirname du \
 		env expand expr factor fmt fold groups head hostid id install \
-		join link logname md5sum mkfifo nice nl nohup od paste pathchk \
+		join link logname md5sum mkfifo nl nohup od paste pathchk \
 		pinky pr printenv printf ptx readlink seq sha1sum shred sort \
 		split stat sum tac tail tee test tr tsort tty unexpand uniq \
 		unlink users vdir wc who whoami yes \
 		"
 
 # hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill \
-		     ln ls mkdir mknod mv pwd rm rmdir sleep stty sync touch \
+base_bindir_progs = "cat chgrp chmod chown cp date dd df echo false kill \
+		     ln ls mkdir mknod mv nice pwd rm rmdir sleep stty sync touch \
 		     true uname \
 		     "
 


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 08/12] Modify location of debianutils executables
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (6 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 07/12] Modify location of coreutils executables Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 09/12] Enable syslog-ng Martyn Welch
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

Modify where the debianutils executables are put so that they conform more
to what we believe to be their standard location.
---

 recipes/debianutils/debianutils.inc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/recipes/debianutils/debianutils.inc b/recipes/debianutils/debianutils.inc
index 35ef03d..0b4f2bf 100644
--- a/recipes/debianutils/debianutils.inc
+++ b/recipes/debianutils/debianutils.inc
@@ -14,10 +14,14 @@ do_install_append() {
 
 pkg_postinst_${PN} () {
 #!/bin/sh
-for app in add-shell  installkernel  mkboot  remove-shell ; do
+for app in add-shell  mkboot  remove-shell ; do
     update-alternatives --install ${sbindir}/$app $app $app.${PN} 100
 done
 
+for app in installkernel ; do
+    update-alternatives --install ${base_sbindir}/$app $app $app.${PN} 100
+done
+
 for app in run-parts  savelog  sensible-browser  sensible-editor  sensible-pager  tempfile  which ; do
     update-alternatives --install ${bindir}/$app $app $app.${PN} 100
 done


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 09/12] Enable syslog-ng
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (7 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 08/12] Modify location of debianutils executables Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 10/12] Add hwclock script to util-linux-ng Martyn Welch
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel


---

 recipes/syslog-ng/syslog-ng_2.0.5.bb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/recipes/syslog-ng/syslog-ng_2.0.5.bb b/recipes/syslog-ng/syslog-ng_2.0.5.bb
index 5b3431c..d32602b 100644
--- a/recipes/syslog-ng/syslog-ng_2.0.5.bb
+++ b/recipes/syslog-ng/syslog-ng_2.0.5.bb
@@ -30,5 +30,5 @@ pkg_postrm() {
 CONFFILES_${PN} = "${sysconfdir}/syslog-ng.conf"
 
 INITSCRIPT_NAME = "syslog-ng"
-#INITSCRIPT_PARAMS = "defaults 05"
-INITSCRIPT_PARAMS = "remove"
+INITSCRIPT_PARAMS = "defaults 05"
+#INITSCRIPT_PARAMS = "remove"


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 10/12] Add hwclock script to util-linux-ng
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (8 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 09/12] Enable syslog-ng Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-23 11:14   ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 11/12] Modify util-linux-ng Martyn Welch
  2010-03-22  9:35 ` [PATCH 12/12] Add ubuntu verison of ifupdown Martyn Welch
  11 siblings, 1 reply; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

Busybox provides a script for managing the RTC, this is not provided by
anything else and will be required for busybox-less builds. Add it to
util-linux-ng for now.

This script is a part of busybox and is used by the boot process.
---

 recipes/util-linux-ng/files/hwclock.sh  |   76 +++++++++++++++++++++++++++++++
 recipes/util-linux-ng/util-linux-ng.inc |    6 ++
 2 files changed, 81 insertions(+), 1 deletions(-)

diff --git a/recipes/util-linux-ng/files/hwclock.sh b/recipes/util-linux-ng/files/hwclock.sh
new file mode 100644
index 0000000..6c0af34
--- /dev/null
+++ b/recipes/util-linux-ng/files/hwclock.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+# hwclock.sh Set system clock to hardware clock, according to the UTC
+#               setting in /etc/default/rcS (see also rcS(5)).
+#
+# WARNING:      If your hardware clock is not in UTC/GMT, this script
+#               must know the local time zone. This information is
+#               stored in /etc/localtime. This might be a problem if
+#               your /etc/localtime is a symlink to something in
+#               /usr/share/zoneinfo AND /usr isn't in the root
+#               partition! The workaround is to define TZ either
+#               in /etc/default/rcS, or in the proper place below.
+
+[ ! -x /sbin/hwclock ] && exit 0
+
+. /etc/default/rcS
+
+[ "$UTC" = yes ] && UTC=--utc || UTC=--localtime
+
+case "$1" in
+        start)
+                if [ "$VERBOSE" != no ]
+                then
+                        echo "System time was `date`."
+                        echo "Setting the System Clock using the Hardware Clock as reference..."
+                fi
+
+		if [ "$HWCLOCKACCESS" != no ]
+		then
+			if [ -z "$TZ" ]
+			then
+	                   hwclock -s $UTC;# --hctosys
+			else
+			   TZ="$TZ" hwclock -s $UTC;# --hctosys
+			fi
+		fi
+
+                if [ "$VERBOSE" != no ]
+                then
+                        echo "System Clock set. System local time is now `date`."
+                fi
+                ;;
+        stop|restart|reload|force-reload)
+		#
+		# Updates the Hardware Clock with the System Clock time.
+		# This will *override* any changes made to the Hardware Clock.
+		#
+		# WARNING: If you disable this, any changes to the system
+		#          clock will not be carried across reboots.
+		#
+		if [ "$VERBOSE" != no ]
+		then
+			echo "Saving the System Clock time to the Hardware Clock..."
+		fi
+		if [ "$HWCLOCKACCESS" != no ]
+		then
+			hwclock -w $UTC;# --systohc
+		fi
+		if [ "$VERBOSE" != no ]
+		then
+			echo "Hardware Clock updated to `date`."
+		fi
+                exit 0
+                ;;
+	show)
+		if [ "$HWCLOCKACCESS" != no ]
+		then
+			hwclock -r $UTC;# --show
+		fi
+		;;
+        *)
+                echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2
+		echo "       start sets kernel (system) clock from hardware (RTC) clock" >&2
+		echo "       stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
+                exit 1
+                ;;
+esac
diff --git a/recipes/util-linux-ng/util-linux-ng.inc b/recipes/util-linux-ng/util-linux-ng.inc
index 1c6e8a8..b2045d7 100644
--- a/recipes/util-linux-ng/util-linux-ng.inc
+++ b/recipes/util-linux-ng/util-linux-ng.inc
@@ -12,7 +12,8 @@ INC_PR = "r16"
 # allows for a release candidate
 RC ?= ""
 
-SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/util-linux-ng/v${PV}/util-linux-ng-${PV}${RC}.tar.bz2;name=archive"
+SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/util-linux-ng/v${PV}/util-linux-ng-${PV}${RC}.tar.bz2;name=archive \
+		file://hwclock.sh "
 
 SRC_URI_append_chinook-compat = " file://chinook_libtool.patch;patch=1 "
 
@@ -157,6 +158,9 @@ do_install () {
                 fi
         done
 
+	install -d ${D}${sysconfdir}/init.d/
+	install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
+	
 	install -d ${D}${sysconfdir}/default/
 	echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall.${PN}
 


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 11/12] Modify util-linux-ng
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (9 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 10/12] Add hwclock script to util-linux-ng Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  2010-03-22  9:35 ` [PATCH 12/12] Add ubuntu verison of ifupdown Martyn Welch
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

Add link to reset command and correct swapoff.
---

 recipes/util-linux-ng/util-linux-ng.inc |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/recipes/util-linux-ng/util-linux-ng.inc b/recipes/util-linux-ng/util-linux-ng.inc
index b2045d7..6ed2ac4 100644
--- a/recipes/util-linux-ng/util-linux-ng.inc
+++ b/recipes/util-linux-ng/util-linux-ng.inc
@@ -160,6 +160,7 @@ do_install () {
 
 	install -d ${D}${sysconfdir}/init.d/
 	install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
+	mv ${S}/misc-utils/reset ${D}${bindir}/reset.${PN}
 	
 	install -d ${D}${sysconfdir}/default/
 	echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall.${PN}
@@ -204,7 +205,8 @@ pkg_postinst_${PN} () {
 	update-alternatives --install ${base_bindir}/login login login.${PN} 100
 	update-alternatives --install ${base_sbindir}/vipw vipw vipw.${PN} 100
 	update-alternatives --install ${base_sbindir}/vigr vigr vigr.${PN} 100
-	
+	update-alternatives --install ${bindir}/reset reset reset.${PN} 100
+
 	# There seems to be problem, atleast on nslu2, with these, until they are
 	# fixed the busybox ones have higher priority
 	update-alternatives --install ${base_sbindir}/hwclock hwclock hwclock.${PN} 10
@@ -217,7 +219,7 @@ pkg_prerm_${PN} () {
 	test -x ${base_sbindir}/pivot_root.${PN} && \
 	update-alternatives --remove pivot_root pivot_root.${PN}
 
-	for i in dmesg kill more halt hwclock mkswap reboot shutdown sln mkfs.minix fsck.minix hecdump last logger mesg renice wall vipw vigr chfn newgrp chsh login ; do
+	for i in dmesg kill more halt hwclock mkswap reboot shutdown sln mkfs.minix fsck.minix hecdump last logger mesg renice wall vipw vigr chfn newgrp chsh login reset ; do
 		update-alternatives --remove $i $i.${PN}
 	done
 }
@@ -255,12 +257,12 @@ pkg_prerm_util-linux-ng-losetup () {
 }
 
 pkg_postinst_util-linux-ng-swaponoff () {
-	update-alternatives --install ${base_sbindir}/swapoff swapoff swapoff.${PN} 100
+	update-alternatives --install ${base_sbindir}/swapoff swapoff swapon.${PN} 100
 	update-alternatives --install ${base_sbindir}/swapon swapon swapon.${PN} 100
 }
 
 pkg_prerm_util-linux-ng-swaponoff () {
-	update-alternatives --remove swapoff swapoff.${PN}
+	update-alternatives --remove swapoff swapon.${PN}
 	update-alternatives --remove swapon swapon.${PN}
 }
 


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 12/12] Add ubuntu verison of ifupdown
  2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
                   ` (10 preceding siblings ...)
  2010-03-22  9:35 ` [PATCH 11/12] Modify util-linux-ng Martyn Welch
@ 2010-03-22  9:35 ` Martyn Welch
  11 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-22  9:35 UTC (permalink / raw)
  To: openembedded-devel

We need some of the features in the ubuntu version of ifupdown, rather than
the version found in Debian.
---

 recipes/ifupdown/ifupdown-ubuntu-0.6.8/init |   15 +++++++++
 recipes/ifupdown/ifupdown-ubuntu_0.6.8.bb   |   45 +++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/recipes/ifupdown/ifupdown-ubuntu-0.6.8/init b/recipes/ifupdown/ifupdown-ubuntu-0.6.8/init
new file mode 100644
index 0000000..fa415e5
--- /dev/null
+++ b/recipes/ifupdown/ifupdown-ubuntu-0.6.8/init
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+
+case "$1" in
+	start|restart)
+		#create the network directory in the volatile /var directory
+		mkdir -p /var/run/network
+		if [ -e /var/run/network/ifstate ]; then
+			echo -n "Cleaning: /var/run/network/ifstate"
+			echo -n >/var/run/network/ifstate
+			echo "."
+		fi
+		;;
+	stop|reload|force-reload)
+		;;
+esac
diff --git a/recipes/ifupdown/ifupdown-ubuntu_0.6.8.bb b/recipes/ifupdown/ifupdown-ubuntu_0.6.8.bb
new file mode 100644
index 0000000..3c8de81
--- /dev/null
+++ b/recipes/ifupdown/ifupdown-ubuntu_0.6.8.bb
@@ -0,0 +1,45 @@
+DESCRIPTION = "High level tools to configure network interfaces \
+This package provides the tools ifup and ifdown which may be used to \
+configure (or, respectively, deconfigure) network interfaces, based on \
+the file /etc/network/interfaces."
+LICENSE = "GPL"
+
+SECTION = "base"
+
+PROVIDES = "ifupdown"
+
+PR = "r2"
+
+inherit update-rc.d
+
+SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/i/ifupdown/ifupdown_0.6.8ubuntu19.tar.gz;name=ifupdown \
+	file://init"
+
+SRC_URI[ifupdown.md5sum] = "9c4533a289bd55316a9981b1fe41fad4"
+SRC_URI[ifupdown.sha256sum] = "4c86cc0534061896c1f825766a29fe5282607123b8978b623f5c6f1fa5458b4d"
+
+EXTRA_OEMAKE = ""
+
+S = "${WORKDIR}/ifupdown-${PV}ubuntu15"
+
+do_compile () {
+	chmod a+rx *.pl *.sh
+	oe_runmake 'CC=${CC}' "CFLAGS=${CFLAGS} -Wall -W -D'IFUPDOWN_VERSION=\"${PV}\"'"
+}
+
+do_install () {
+	install -d ${D}${sysconfdir}/init.d \
+		   ${D}${sysconfdir}/network \
+		   ${D}${mandir}/man8 \
+		   ${D}${mandir}/man5 \
+		   ${D}${base_sbindir}
+	install -m 0755 ifup ${D}${base_sbindir}/
+	ln ${D}${base_sbindir}/ifup ${D}${base_sbindir}/ifdown
+	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/ifup
+	install -m 0644 ifup.8 ${D}${mandir}/man8
+	install -m 0644 interfaces.5 ${D}${mandir}/man5
+	cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
+}
+INITSCRIPT_NAME = "ifup"
+INITSCRIPT_PARAMS = "start 39 S . stop 39 0 6 1 ."
+


--
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 01/12] commit 587374363efe3fbd07f6a3d25bfb11230ac012f9
  2010-03-22  9:34 ` [PATCH 01/12] commit 587374363efe3fbd07f6a3d25bfb11230ac012f9 Martyn Welch
@ 2010-03-22  9:51   ` Marcin Juszkiewicz
  0 siblings, 0 replies; 17+ messages in thread
From: Marcin Juszkiewicz @ 2010-03-22  9:51 UTC (permalink / raw)
  To: openembedded-devel

Dnia poniedziałek, 22 marca 2010 o 10:34:40 Martyn Welch napisał(a):
> Funky alt busybox
> 
>     This patch provides a mechanism to replace busybox buy defining a
> busybox package which actually just requires a set of other packages.
> 
>     To get it to be used rather than the standard busybox, define:
> 
>     PREFERRED_PROVIDER_busybox = "busybox-alt"

Please merge that into tasks/task-proper-tools.bb which was created for same 
reason.

Regards, 
-- 
JID:      hrw@jabber.org
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 05/12] Add alternatives to patch
  2010-03-22  9:35 ` [PATCH 05/12] Add alternatives to patch Martyn Welch
@ 2010-03-22  9:53   ` Marcin Juszkiewicz
  2010-03-23 10:49     ` Martyn Welch
  0 siblings, 1 reply; 17+ messages in thread
From: Marcin Juszkiewicz @ 2010-03-22  9:53 UTC (permalink / raw)
  To: openembedded-devel

Dnia poniedziałek, 22 marca 2010 o 10:35:06 Martyn Welch napisał(a):
> This adds an alternatives link for /bin/sh to the bash package. When
> installed this will make bash overide the busybox provided shell for
> "/bin/sh". This may or may not be desirable, but including it does allow an
> image to be provided without busybox.

update-alternatives is shell script so we can end in shellless system ;(

Regards, 
-- 
JID:      hrw@jabber.org
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 05/12] Add alternatives to patch
  2010-03-22  9:53   ` Marcin Juszkiewicz
@ 2010-03-23 10:49     ` Martyn Welch
  0 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-23 10:49 UTC (permalink / raw)
  To: openembedded-devel

Marcin Juszkiewicz wrote:
> Dnia poniedziałek, 22 marca 2010 o 10:35:06 Martyn Welch napisał(a):
>   
>> This adds an alternatives link for /bin/sh to the bash package. When
>> installed this will make bash overide the busybox provided shell for
>> "/bin/sh". This may or may not be desirable, but including it does allow an
>> image to be provided without busybox.
>>     
>
> update-alternatives is shell script so we can end in shellless system ;(
>
> Regards, 
>   

Hm, hadn't appreciated that.

I'd assumed that this was the same as the update-alternatives used in
Debian, but looking in the relevant recipes directory I now appreciate
that this probably isn't the case. It looks like the "dpkg" version is
perl rather than shell and I assume it doesn't have the same problem
because perl isn't managed though the alternatives system. I suspect
there may be only one provider of perl...

Martyn

-- 
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 10/12] Add hwclock script to util-linux-ng
  2010-03-22  9:35 ` [PATCH 10/12] Add hwclock script to util-linux-ng Martyn Welch
@ 2010-03-23 11:14   ` Martyn Welch
  0 siblings, 0 replies; 17+ messages in thread
From: Martyn Welch @ 2010-03-23 11:14 UTC (permalink / raw)
  To: openembedded-devel

Martyn Welch wrote:
> Busybox provides a script for managing the RTC, this is not provided by
> anything else and will be required for busybox-less builds. Add it to
> util-linux-ng for now

This clearly needs to be a part of the proposed "busybox-alt" recipe,
not util-linux-ng.

Martyn

-- 
Martyn Welch (Principal Software Engineer)   |   Registered in England and
GE Intelligent Platforms                     |   Wales (3828642) at 100
T +44(0)127322748                            |   Barbirolli Square, Manchester,
E martyn.welch@ge.com                        |   M2 3AB  VAT:GB 927559189




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-03-23 11:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-22  9:34 [RFC] Enabling busybox-less builds Martyn Welch
2010-03-22  9:34 ` [PATCH 01/12] commit 587374363efe3fbd07f6a3d25bfb11230ac012f9 Martyn Welch
2010-03-22  9:51   ` Marcin Juszkiewicz
2010-03-22  9:34 ` [PATCH 02/12] commit fac64459a3623afe4590bf1de9de826a79e0a8fe Martyn Welch
2010-03-22  9:34 ` [PATCH 03/12] commit fefdbcf87a306218d600666c86a99e72e5fdde35 Martyn Welch
2010-03-22  9:35 ` [PATCH 04/12] commit 1484faec83f86877d1fa8c267de035e0016e4386 Martyn Welch
2010-03-22  9:35 ` [PATCH 05/12] Add alternatives to patch Martyn Welch
2010-03-22  9:53   ` Marcin Juszkiewicz
2010-03-23 10:49     ` Martyn Welch
2010-03-22  9:35 ` [PATCH 06/12] Modify location of busybox applets Martyn Welch
2010-03-22  9:35 ` [PATCH 07/12] Modify location of coreutils executables Martyn Welch
2010-03-22  9:35 ` [PATCH 08/12] Modify location of debianutils executables Martyn Welch
2010-03-22  9:35 ` [PATCH 09/12] Enable syslog-ng Martyn Welch
2010-03-22  9:35 ` [PATCH 10/12] Add hwclock script to util-linux-ng Martyn Welch
2010-03-23 11:14   ` Martyn Welch
2010-03-22  9:35 ` [PATCH 11/12] Modify util-linux-ng Martyn Welch
2010-03-22  9:35 ` [PATCH 12/12] Add ubuntu verison of ifupdown Martyn Welch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.