From: Rob Landley Date: Sun, 9 Jul 2006 17:28:17 +0000 (-0000) Subject: Patch from Shaun Jackman to set environment variable RUNLEVEL equal to X-Git-Tag: 1_2_0~28 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cba1b967358c3a552a8d187861284ede98b9fc76;p=oweals%2Fbusybox.git Patch from Shaun Jackman to set environment variable RUNLEVEL equal to init's argv[1], so if you append "single" to your kernel command line and the kernel doesn't parse it, RUNLELEL=single. Plus a few unrelated header cleanups while I was in the area... --- diff --git a/init/init.c b/init/init.c index 877b08122..c9200bd6c 100644 --- a/init/init.c +++ b/init/init.c @@ -10,35 +10,19 @@ */ #include "busybox.h" -#include -#include #include #include #include -#include -#include -#include -#include -#include -#include #include -#include #include #include #include "init_shared.h" - #ifdef CONFIG_SYSLOGD # include #endif - -#ifdef CONFIG_SELINUX -# include -#endif /* CONFIG_SELINUX */ - - #define INIT_BUFFS_SIZE 256 /* From */ @@ -72,7 +56,6 @@ struct serial_struct { int reserved[1]; }; - #ifndef _PATH_STDPATH #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" #endif @@ -88,8 +71,6 @@ struct serial_struct { #include #endif -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) - #define INITTAB "/etc/inittab" /* inittab file location */ #ifndef INIT_SCRIPT #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ @@ -1046,6 +1027,9 @@ int init_main(int argc, char **argv) for(e = environment; *e; e++) putenv((char *) *e); } + + if (argc > 1) setenv("RUNLEVEL", argv[1], 1); + /* Hello world */ message(MAYBE_CONSOLE | LOG, "init started: %s", bb_msg_full_version);