diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-06-24 13:39:13 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-06-24 15:05:22 +0200 |
commit | 67e1529b921416d6c3f33fb43691bc9919e3eacc (patch) | |
tree | 874946bf7b52062d7496ea612b62f1cfe95f864f | |
parent | d5314e71294d228cff5d86e00d15661461f68fc9 (diff) | |
download | busybox-w32-67e1529b921416d6c3f33fb43691bc9919e3eacc.tar.gz busybox-w32-67e1529b921416d6c3f33fb43691bc9919e3eacc.tar.bz2 busybox-w32-67e1529b921416d6c3f33fb43691bc9919e3eacc.zip |
nologin: make it possible to build it as single applet
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/appletlib.c | 38 | ||||
-rw-r--r-- | shell/Config.src | 20 | ||||
-rw-r--r-- | shell/ash.c | 41 | ||||
-rw-r--r-- | shell/hush.c | 73 | ||||
-rw-r--r-- | util-linux/nologin.c | 2 |
5 files changed, 110 insertions, 64 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index f842e73cc..a515c3fe3 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -754,7 +754,9 @@ static void install_links(const char *busybox UNUSED_PARAM, | |||
754 | } | 754 | } |
755 | # endif | 755 | # endif |
756 | 756 | ||
757 | # if ENABLE_BUSYBOX || NUM_APPLETS > 0 | ||
757 | static void run_applet_and_exit(const char *name, char **argv) NORETURN; | 758 | static void run_applet_and_exit(const char *name, char **argv) NORETURN; |
759 | #endif | ||
758 | 760 | ||
759 | # if NUM_SCRIPTS > 0 | 761 | # if NUM_SCRIPTS > 0 |
760 | static int find_script_by_name(const char *name) | 762 | static int find_script_by_name(const char *name) |
@@ -775,13 +777,13 @@ int scripted_main(int argc UNUSED_PARAM, char **argv) | |||
775 | { | 777 | { |
776 | int script = find_script_by_name(applet_name); | 778 | int script = find_script_by_name(applet_name); |
777 | if (script >= 0) | 779 | if (script >= 0) |
778 | #if ENABLE_ASH || ENABLE_SH_IS_ASH || ENABLE_BASH_IS_ASH | 780 | # if ENABLE_SHELL_ASH |
779 | exit(ash_main(-script - 1, argv)); | 781 | exit(ash_main(-script - 1, argv)); |
780 | #elif ENABLE_HUSH || ENABLE_SH_IS_HUSH || ENABLE_BASH_IS_HUSH | 782 | # elif ENABLE_SHELL_HUSH |
781 | exit(hush_main(-script - 1, argv)); | 783 | exit(hush_main(-script - 1, argv)); |
782 | #else | 784 | # else |
783 | return 1; | 785 | return 1; |
784 | #endif | 786 | # endif |
785 | return 0; | 787 | return 0; |
786 | } | 788 | } |
787 | 789 | ||
@@ -1024,7 +1026,33 @@ static NORETURN void run_applet_and_exit(const char *name, char **argv) | |||
1024 | } | 1026 | } |
1025 | # endif | 1027 | # endif |
1026 | 1028 | ||
1027 | #endif /* !defined(SINGLE_APPLET_MAIN) */ | 1029 | #else /* defined(SINGLE_APPLET_MAIN) */ |
1030 | |||
1031 | # if NUM_SCRIPTS > 0 | ||
1032 | /* if SINGLE_APPLET_MAIN, these two functions are simpler: */ | ||
1033 | int scripted_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE; | ||
1034 | int scripted_main(int argc UNUSED_PARAM, char **argv) | ||
1035 | { | ||
1036 | # if ENABLE_SHELL_ASH | ||
1037 | int script = 0; | ||
1038 | exit(ash_main(-script - 1, argv)); | ||
1039 | # elif ENABLE_SHELL_HUSH | ||
1040 | int script = 0; | ||
1041 | exit(hush_main(-script - 1, argv)); | ||
1042 | # else | ||
1043 | return 1; | ||
1044 | # endif | ||
1045 | } | ||
1046 | char* FAST_FUNC | ||
1047 | get_script_content(unsigned n UNUSED_PARAM) | ||
1048 | { | ||
1049 | char *t = unpack_bz2_data(packed_scripts, sizeof(packed_scripts), | ||
1050 | UNPACKED_SCRIPTS_LENGTH); | ||
1051 | return t; | ||
1052 | } | ||
1053 | # endif /* NUM_SCRIPTS > 0 */ | ||
1054 | |||
1055 | #endif /* defined(SINGLE_APPLET_MAIN) */ | ||
1028 | 1056 | ||
1029 | 1057 | ||
1030 | #if ENABLE_BUILD_LIBBUSYBOX | 1058 | #if ENABLE_BUILD_LIBBUSYBOX |
diff --git a/shell/Config.src b/shell/Config.src index d7623f774..5efbf9995 100644 --- a/shell/Config.src +++ b/shell/Config.src | |||
@@ -17,6 +17,7 @@ choice | |||
17 | config SH_IS_ASH | 17 | config SH_IS_ASH |
18 | depends on !NOMMU | 18 | depends on !NOMMU |
19 | bool "ash" | 19 | bool "ash" |
20 | select SHELL_ASH | ||
20 | help | 21 | help |
21 | Choose ash to be the shell executed by 'sh' name. | 22 | Choose ash to be the shell executed by 'sh' name. |
22 | The ash code will be built into busybox. If you don't select | 23 | The ash code will be built into busybox. If you don't select |
@@ -25,6 +26,7 @@ config SH_IS_ASH | |||
25 | 26 | ||
26 | config SH_IS_HUSH | 27 | config SH_IS_HUSH |
27 | bool "hush" | 28 | bool "hush" |
29 | select SHELL_HUSH | ||
28 | help | 30 | help |
29 | Choose hush to be the shell executed by 'sh' name. | 31 | Choose hush to be the shell executed by 'sh' name. |
30 | The hush code will be built into busybox. If you don't select | 32 | The hush code will be built into busybox. If you don't select |
@@ -57,6 +59,7 @@ choice | |||
57 | config BASH_IS_ASH | 59 | config BASH_IS_ASH |
58 | depends on !NOMMU | 60 | depends on !NOMMU |
59 | bool "ash" | 61 | bool "ash" |
62 | select SHELL_ASH | ||
60 | help | 63 | help |
61 | Choose ash to be the shell executed by 'bash' name. | 64 | Choose ash to be the shell executed by 'bash' name. |
62 | The ash code will be built into busybox. If you don't select | 65 | The ash code will be built into busybox. If you don't select |
@@ -65,6 +68,7 @@ config BASH_IS_ASH | |||
65 | 68 | ||
66 | config BASH_IS_HUSH | 69 | config BASH_IS_HUSH |
67 | bool "hush" | 70 | bool "hush" |
71 | select SHELL_HUSH | ||
68 | help | 72 | help |
69 | Choose hush to be the shell executed by 'bash' name. | 73 | Choose hush to be the shell executed by 'bash' name. |
70 | The hush code will be built into busybox. If you don't select | 74 | The hush code will be built into busybox. If you don't select |
@@ -81,12 +85,12 @@ INSERT | |||
81 | 85 | ||
82 | 86 | ||
83 | comment "Options common to all shells" | 87 | comment "Options common to all shells" |
84 | if ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 88 | if SHELL_ASH || SHELL_HUSH |
85 | 89 | ||
86 | config FEATURE_SH_MATH | 90 | config FEATURE_SH_MATH |
87 | bool "POSIX math support" | 91 | bool "POSIX math support" |
88 | default y | 92 | default y |
89 | depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 93 | depends on SHELL_ASH || SHELL_HUSH |
90 | help | 94 | help |
91 | Enable math support in the shell via $((...)) syntax. | 95 | Enable math support in the shell via $((...)) syntax. |
92 | 96 | ||
@@ -107,14 +111,14 @@ config FEATURE_SH_MATH_BASE | |||
107 | config FEATURE_SH_EXTRA_QUIET | 111 | config FEATURE_SH_EXTRA_QUIET |
108 | bool "Hide message on interactive shell startup" | 112 | bool "Hide message on interactive shell startup" |
109 | default y | 113 | default y |
110 | depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 114 | depends on SHELL_ASH || SHELL_HUSH |
111 | help | 115 | help |
112 | Remove the busybox introduction when starting a shell. | 116 | Remove the busybox introduction when starting a shell. |
113 | 117 | ||
114 | config FEATURE_SH_STANDALONE | 118 | config FEATURE_SH_STANDALONE |
115 | bool "Standalone shell" | 119 | bool "Standalone shell" |
116 | default n | 120 | default n |
117 | depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 121 | depends on SHELL_ASH || SHELL_HUSH |
118 | help | 122 | help |
119 | This option causes busybox shells to use busybox applets | 123 | This option causes busybox shells to use busybox applets |
120 | in preference to executables in the PATH whenever possible. For | 124 | in preference to executables in the PATH whenever possible. For |
@@ -135,7 +139,7 @@ config FEATURE_SH_STANDALONE | |||
135 | config FEATURE_SH_NOFORK | 139 | config FEATURE_SH_NOFORK |
136 | bool "Run 'nofork' applets directly" | 140 | bool "Run 'nofork' applets directly" |
137 | default n | 141 | default n |
138 | depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 142 | depends on SHELL_ASH || SHELL_HUSH |
139 | help | 143 | help |
140 | This option causes busybox shells to not execute typical | 144 | This option causes busybox shells to not execute typical |
141 | fork/exec/wait sequence, but call <applet>_main directly, | 145 | fork/exec/wait sequence, but call <applet>_main directly, |
@@ -153,14 +157,14 @@ config FEATURE_SH_NOFORK | |||
153 | config FEATURE_SH_READ_FRAC | 157 | config FEATURE_SH_READ_FRAC |
154 | bool "read -t N.NNN support (+110 bytes)" | 158 | bool "read -t N.NNN support (+110 bytes)" |
155 | default y | 159 | default y |
156 | depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 160 | depends on SHELL_ASH || SHELL_HUSH |
157 | help | 161 | help |
158 | Enable support for fractional second timeout in read builtin. | 162 | Enable support for fractional second timeout in read builtin. |
159 | 163 | ||
160 | config FEATURE_SH_HISTFILESIZE | 164 | config FEATURE_SH_HISTFILESIZE |
161 | bool "Use $HISTFILESIZE" | 165 | bool "Use $HISTFILESIZE" |
162 | default y | 166 | default y |
163 | depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 167 | depends on SHELL_ASH || SHELL_HUSH |
164 | help | 168 | help |
165 | This option makes busybox shells to use $HISTFILESIZE variable | 169 | This option makes busybox shells to use $HISTFILESIZE variable |
166 | to set shell history size. Note that its max value is capped | 170 | to set shell history size. Note that its max value is capped |
@@ -169,7 +173,7 @@ config FEATURE_SH_HISTFILESIZE | |||
169 | config FEATURE_SH_EMBEDDED_SCRIPTS | 173 | config FEATURE_SH_EMBEDDED_SCRIPTS |
170 | bool "Embed scripts in the binary" | 174 | bool "Embed scripts in the binary" |
171 | default y | 175 | default y |
172 | depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH | 176 | depends on SHELL_ASH || SHELL_HUSH |
173 | help | 177 | help |
174 | Allow scripts to be compressed and embedded in the busybox | 178 | Allow scripts to be compressed and embedded in the busybox |
175 | binary. The scripts should be placed in the 'embed' directory | 179 | binary. The scripts should be placed in the 'embed' directory |
diff --git a/shell/ash.c b/shell/ash.c index 2a4c839a7..ecb9b132b 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -15,10 +15,15 @@ | |||
15 | * | 15 | * |
16 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 16 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
17 | */ | 17 | */ |
18 | //config:config SHELL_ASH | ||
19 | //config: bool #hidden option | ||
20 | //config: depends on !NOMMU | ||
21 | //config: | ||
18 | //config:config ASH | 22 | //config:config ASH |
19 | //config: bool "ash (78 kb)" | 23 | //config: bool "ash (78 kb)" |
20 | //config: default y | 24 | //config: default y |
21 | //config: depends on !NOMMU | 25 | //config: depends on !NOMMU |
26 | //config: select SHELL_ASH | ||
22 | //config: help | 27 | //config: help |
23 | //config: The most complete and most pedantically correct shell included with | 28 | //config: The most complete and most pedantically correct shell included with |
24 | //config: busybox. This shell is actually a derivative of the Debian 'dash' | 29 | //config: busybox. This shell is actually a derivative of the Debian 'dash' |
@@ -28,17 +33,17 @@ | |||
28 | //config:# ash options | 33 | //config:# ash options |
29 | //config:# note: Don't remove !NOMMU part in the next line; it would break | 34 | //config:# note: Don't remove !NOMMU part in the next line; it would break |
30 | //config:# menuconfig's indenting. | 35 | //config:# menuconfig's indenting. |
31 | //config:if !NOMMU && (ASH || SH_IS_ASH || BASH_IS_ASH) | 36 | //config:if !NOMMU && (SHELL_ASH || ASH || SH_IS_ASH || BASH_IS_ASH) |
32 | //config: | 37 | //config: |
33 | //config:config ASH_OPTIMIZE_FOR_SIZE | 38 | //config:config ASH_OPTIMIZE_FOR_SIZE |
34 | //config: bool "Optimize for size instead of speed" | 39 | //config: bool "Optimize for size instead of speed" |
35 | //config: default y | 40 | //config: default y |
36 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 41 | //config: depends on SHELL_ASH |
37 | //config: | 42 | //config: |
38 | //config:config ASH_INTERNAL_GLOB | 43 | //config:config ASH_INTERNAL_GLOB |
39 | //config: bool "Use internal glob() implementation" | 44 | //config: bool "Use internal glob() implementation" |
40 | //config: default y # Y is bigger, but because of uclibc glob() bug, let Y be default for now | 45 | //config: default y # Y is bigger, but because of uclibc glob() bug, let Y be default for now |
41 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 46 | //config: depends on SHELL_ASH |
42 | //config: help | 47 | //config: help |
43 | //config: Do not use glob() function from libc, use internal implementation. | 48 | //config: Do not use glob() function from libc, use internal implementation. |
44 | //config: Use this if you are getting "glob.h: No such file or directory" | 49 | //config: Use this if you are getting "glob.h: No such file or directory" |
@@ -49,7 +54,7 @@ | |||
49 | //config:config ASH_BASH_COMPAT | 54 | //config:config ASH_BASH_COMPAT |
50 | //config: bool "bash-compatible extensions" | 55 | //config: bool "bash-compatible extensions" |
51 | //config: default y | 56 | //config: default y |
52 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 57 | //config: depends on SHELL_ASH |
53 | //config: | 58 | //config: |
54 | //config:config ASH_BASH_SOURCE_CURDIR | 59 | //config:config ASH_BASH_SOURCE_CURDIR |
55 | //config: bool "'source' and '.' builtins search current directory after $PATH" | 60 | //config: bool "'source' and '.' builtins search current directory after $PATH" |
@@ -70,17 +75,17 @@ | |||
70 | //config:config ASH_JOB_CONTROL | 75 | //config:config ASH_JOB_CONTROL |
71 | //config: bool "Job control" | 76 | //config: bool "Job control" |
72 | //config: default y | 77 | //config: default y |
73 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 78 | //config: depends on SHELL_ASH |
74 | //config: | 79 | //config: |
75 | //config:config ASH_ALIAS | 80 | //config:config ASH_ALIAS |
76 | //config: bool "Alias support" | 81 | //config: bool "Alias support" |
77 | //config: default y | 82 | //config: default y |
78 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 83 | //config: depends on SHELL_ASH |
79 | //config: | 84 | //config: |
80 | //config:config ASH_RANDOM_SUPPORT | 85 | //config:config ASH_RANDOM_SUPPORT |
81 | //config: bool "Pseudorandom generator and $RANDOM variable" | 86 | //config: bool "Pseudorandom generator and $RANDOM variable" |
82 | //config: default y | 87 | //config: default y |
83 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 88 | //config: depends on SHELL_ASH |
84 | //config: help | 89 | //config: help |
85 | //config: Enable pseudorandom generator and dynamic variable "$RANDOM". | 90 | //config: Enable pseudorandom generator and dynamic variable "$RANDOM". |
86 | //config: Each read of "$RANDOM" will generate a new pseudorandom value. | 91 | //config: Each read of "$RANDOM" will generate a new pseudorandom value. |
@@ -91,7 +96,7 @@ | |||
91 | //config:config ASH_EXPAND_PRMT | 96 | //config:config ASH_EXPAND_PRMT |
92 | //config: bool "Expand prompt string" | 97 | //config: bool "Expand prompt string" |
93 | //config: default y | 98 | //config: default y |
94 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 99 | //config: depends on SHELL_ASH |
95 | //config: help | 100 | //config: help |
96 | //config: $PS# may contain volatile content, such as backquote commands. | 101 | //config: $PS# may contain volatile content, such as backquote commands. |
97 | //config: This option recreates the prompt string from the environment | 102 | //config: This option recreates the prompt string from the environment |
@@ -100,14 +105,14 @@ | |||
100 | //config:config ASH_IDLE_TIMEOUT | 105 | //config:config ASH_IDLE_TIMEOUT |
101 | //config: bool "Idle timeout variable $TMOUT" | 106 | //config: bool "Idle timeout variable $TMOUT" |
102 | //config: default y | 107 | //config: default y |
103 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 108 | //config: depends on SHELL_ASH |
104 | //config: help | 109 | //config: help |
105 | //config: Enable bash-like auto-logout after $TMOUT seconds of idle time. | 110 | //config: Enable bash-like auto-logout after $TMOUT seconds of idle time. |
106 | //config: | 111 | //config: |
107 | //config:config ASH_MAIL | 112 | //config:config ASH_MAIL |
108 | //config: bool "Check for new mail in interactive shell" | 113 | //config: bool "Check for new mail in interactive shell" |
109 | //config: default y | 114 | //config: default y |
110 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 115 | //config: depends on SHELL_ASH |
111 | //config: help | 116 | //config: help |
112 | //config: Enable "check for new mail" function: | 117 | //config: Enable "check for new mail" function: |
113 | //config: if set, $MAIL file and $MAILPATH list of files | 118 | //config: if set, $MAIL file and $MAILPATH list of files |
@@ -117,32 +122,32 @@ | |||
117 | //config:config ASH_ECHO | 122 | //config:config ASH_ECHO |
118 | //config: bool "echo builtin" | 123 | //config: bool "echo builtin" |
119 | //config: default y | 124 | //config: default y |
120 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 125 | //config: depends on SHELL_ASH |
121 | //config: | 126 | //config: |
122 | //config:config ASH_PRINTF | 127 | //config:config ASH_PRINTF |
123 | //config: bool "printf builtin" | 128 | //config: bool "printf builtin" |
124 | //config: default y | 129 | //config: default y |
125 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 130 | //config: depends on SHELL_ASH |
126 | //config: | 131 | //config: |
127 | //config:config ASH_TEST | 132 | //config:config ASH_TEST |
128 | //config: bool "test builtin" | 133 | //config: bool "test builtin" |
129 | //config: default y | 134 | //config: default y |
130 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 135 | //config: depends on SHELL_ASH |
131 | //config: | 136 | //config: |
132 | //config:config ASH_HELP | 137 | //config:config ASH_HELP |
133 | //config: bool "help builtin" | 138 | //config: bool "help builtin" |
134 | //config: default y | 139 | //config: default y |
135 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 140 | //config: depends on SHELL_ASH |
136 | //config: | 141 | //config: |
137 | //config:config ASH_GETOPTS | 142 | //config:config ASH_GETOPTS |
138 | //config: bool "getopts builtin" | 143 | //config: bool "getopts builtin" |
139 | //config: default y | 144 | //config: default y |
140 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 145 | //config: depends on SHELL_ASH |
141 | //config: | 146 | //config: |
142 | //config:config ASH_CMDCMD | 147 | //config:config ASH_CMDCMD |
143 | //config: bool "command builtin" | 148 | //config: bool "command builtin" |
144 | //config: default y | 149 | //config: default y |
145 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 150 | //config: depends on SHELL_ASH |
146 | //config: help | 151 | //config: help |
147 | //config: Enable support for the 'command' builtin, which allows | 152 | //config: Enable support for the 'command' builtin, which allows |
148 | //config: you to run the specified command or builtin, | 153 | //config: you to run the specified command or builtin, |
@@ -155,9 +160,7 @@ | |||
155 | //applet:IF_SH_IS_ASH( APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) | 160 | //applet:IF_SH_IS_ASH( APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) |
156 | //applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) | 161 | //applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) |
157 | 162 | ||
158 | //kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o | 163 | //kbuild:lib-$(CONFIG_SHELL_ASH) += ash.o ash_ptr_hack.o shell_common.o |
159 | //kbuild:lib-$(CONFIG_SH_IS_ASH) += ash.o ash_ptr_hack.o shell_common.o | ||
160 | //kbuild:lib-$(CONFIG_BASH_IS_ASH) += ash.o ash_ptr_hack.o shell_common.o | ||
161 | //kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o | 164 | //kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o |
162 | 165 | ||
163 | /* | 166 | /* |
diff --git a/shell/hush.c b/shell/hush.c index 2cf2170ca..e9cec1cc9 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -95,6 +95,7 @@ | |||
95 | //config:config HUSH | 95 | //config:config HUSH |
96 | //config: bool "hush (68 kb)" | 96 | //config: bool "hush (68 kb)" |
97 | //config: default y | 97 | //config: default y |
98 | //config: select SHELL_HUSH | ||
98 | //config: help | 99 | //config: help |
99 | //config: hush is a small shell. It handles the normal flow control | 100 | //config: hush is a small shell. It handles the normal flow control |
100 | //config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, | 101 | //config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, |
@@ -106,10 +107,20 @@ | |||
106 | //config: It does not handle select, aliases, tilde expansion, | 107 | //config: It does not handle select, aliases, tilde expansion, |
107 | //config: &>file and >&file redirection of stdout+stderr. | 108 | //config: &>file and >&file redirection of stdout+stderr. |
108 | //config: | 109 | //config: |
110 | // This option is visible (has a description) to make it possible to select | ||
111 | // a "scripted" applet (such as NOLOGIN) but avoid selecting any shells: | ||
112 | //config:config SHELL_HUSH | ||
113 | //config: bool "Internal shell for embedded script support" | ||
114 | //config: default n | ||
115 | //config: | ||
116 | //config:# hush options | ||
117 | //config:# It's only needed to get "nice" menuconfig indenting. | ||
118 | //config:if SHELL_HUSH || HUSH || SH_IS_HUSH || BASH_IS_HUSH | ||
119 | //config: | ||
109 | //config:config HUSH_BASH_COMPAT | 120 | //config:config HUSH_BASH_COMPAT |
110 | //config: bool "bash-compatible extensions" | 121 | //config: bool "bash-compatible extensions" |
111 | //config: default y | 122 | //config: default y |
112 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 123 | //config: depends on SHELL_HUSH |
113 | //config: | 124 | //config: |
114 | //config:config HUSH_BRACE_EXPANSION | 125 | //config:config HUSH_BRACE_EXPANSION |
115 | //config: bool "Brace expansion" | 126 | //config: bool "Brace expansion" |
@@ -133,7 +144,7 @@ | |||
133 | //config:config HUSH_INTERACTIVE | 144 | //config:config HUSH_INTERACTIVE |
134 | //config: bool "Interactive mode" | 145 | //config: bool "Interactive mode" |
135 | //config: default y | 146 | //config: default y |
136 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 147 | //config: depends on SHELL_HUSH |
137 | //config: help | 148 | //config: help |
138 | //config: Enable interactive mode (prompt and command editing). | 149 | //config: Enable interactive mode (prompt and command editing). |
139 | //config: Without this, hush simply reads and executes commands | 150 | //config: Without this, hush simply reads and executes commands |
@@ -159,31 +170,31 @@ | |||
159 | //config:config HUSH_TICK | 170 | //config:config HUSH_TICK |
160 | //config: bool "Support command substitution" | 171 | //config: bool "Support command substitution" |
161 | //config: default y | 172 | //config: default y |
162 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 173 | //config: depends on SHELL_HUSH |
163 | //config: help | 174 | //config: help |
164 | //config: Enable `command` and $(command). | 175 | //config: Enable `command` and $(command). |
165 | //config: | 176 | //config: |
166 | //config:config HUSH_IF | 177 | //config:config HUSH_IF |
167 | //config: bool "Support if/then/elif/else/fi" | 178 | //config: bool "Support if/then/elif/else/fi" |
168 | //config: default y | 179 | //config: default y |
169 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 180 | //config: depends on SHELL_HUSH |
170 | //config: | 181 | //config: |
171 | //config:config HUSH_LOOPS | 182 | //config:config HUSH_LOOPS |
172 | //config: bool "Support for, while and until loops" | 183 | //config: bool "Support for, while and until loops" |
173 | //config: default y | 184 | //config: default y |
174 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 185 | //config: depends on SHELL_HUSH |
175 | //config: | 186 | //config: |
176 | //config:config HUSH_CASE | 187 | //config:config HUSH_CASE |
177 | //config: bool "Support case ... esac statement" | 188 | //config: bool "Support case ... esac statement" |
178 | //config: default y | 189 | //config: default y |
179 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 190 | //config: depends on SHELL_HUSH |
180 | //config: help | 191 | //config: help |
181 | //config: Enable case ... esac statement. +400 bytes. | 192 | //config: Enable case ... esac statement. +400 bytes. |
182 | //config: | 193 | //config: |
183 | //config:config HUSH_FUNCTIONS | 194 | //config:config HUSH_FUNCTIONS |
184 | //config: bool "Support funcname() { commands; } syntax" | 195 | //config: bool "Support funcname() { commands; } syntax" |
185 | //config: default y | 196 | //config: default y |
186 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 197 | //config: depends on SHELL_HUSH |
187 | //config: help | 198 | //config: help |
188 | //config: Enable support for shell functions. +800 bytes. | 199 | //config: Enable support for shell functions. +800 bytes. |
189 | //config: | 200 | //config: |
@@ -197,7 +208,7 @@ | |||
197 | //config:config HUSH_RANDOM_SUPPORT | 208 | //config:config HUSH_RANDOM_SUPPORT |
198 | //config: bool "Pseudorandom generator and $RANDOM variable" | 209 | //config: bool "Pseudorandom generator and $RANDOM variable" |
199 | //config: default y | 210 | //config: default y |
200 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 211 | //config: depends on SHELL_HUSH |
201 | //config: help | 212 | //config: help |
202 | //config: Enable pseudorandom generator and dynamic variable "$RANDOM". | 213 | //config: Enable pseudorandom generator and dynamic variable "$RANDOM". |
203 | //config: Each read of "$RANDOM" will generate a new pseudorandom value. | 214 | //config: Each read of "$RANDOM" will generate a new pseudorandom value. |
@@ -205,7 +216,7 @@ | |||
205 | //config:config HUSH_MODE_X | 216 | //config:config HUSH_MODE_X |
206 | //config: bool "Support 'hush -x' option and 'set -x' command" | 217 | //config: bool "Support 'hush -x' option and 'set -x' command" |
207 | //config: default y | 218 | //config: default y |
208 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 219 | //config: depends on SHELL_HUSH |
209 | //config: help | 220 | //config: help |
210 | //config: This instructs hush to print commands before execution. | 221 | //config: This instructs hush to print commands before execution. |
211 | //config: Adds ~300 bytes. | 222 | //config: Adds ~300 bytes. |
@@ -213,27 +224,27 @@ | |||
213 | //config:config HUSH_ECHO | 224 | //config:config HUSH_ECHO |
214 | //config: bool "echo builtin" | 225 | //config: bool "echo builtin" |
215 | //config: default y | 226 | //config: default y |
216 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 227 | //config: depends on SHELL_HUSH |
217 | //config: | 228 | //config: |
218 | //config:config HUSH_PRINTF | 229 | //config:config HUSH_PRINTF |
219 | //config: bool "printf builtin" | 230 | //config: bool "printf builtin" |
220 | //config: default y | 231 | //config: default y |
221 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 232 | //config: depends on SHELL_HUSH |
222 | //config: | 233 | //config: |
223 | //config:config HUSH_TEST | 234 | //config:config HUSH_TEST |
224 | //config: bool "test builtin" | 235 | //config: bool "test builtin" |
225 | //config: default y | 236 | //config: default y |
226 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 237 | //config: depends on SHELL_HUSH |
227 | //config: | 238 | //config: |
228 | //config:config HUSH_HELP | 239 | //config:config HUSH_HELP |
229 | //config: bool "help builtin" | 240 | //config: bool "help builtin" |
230 | //config: default y | 241 | //config: default y |
231 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 242 | //config: depends on SHELL_HUSH |
232 | //config: | 243 | //config: |
233 | //config:config HUSH_EXPORT | 244 | //config:config HUSH_EXPORT |
234 | //config: bool "export builtin" | 245 | //config: bool "export builtin" |
235 | //config: default y | 246 | //config: default y |
236 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 247 | //config: depends on SHELL_HUSH |
237 | //config: | 248 | //config: |
238 | //config:config HUSH_EXPORT_N | 249 | //config:config HUSH_EXPORT_N |
239 | //config: bool "Support 'export -n' option" | 250 | //config: bool "Support 'export -n' option" |
@@ -245,83 +256,83 @@ | |||
245 | //config:config HUSH_READONLY | 256 | //config:config HUSH_READONLY |
246 | //config: bool "readonly builtin" | 257 | //config: bool "readonly builtin" |
247 | //config: default y | 258 | //config: default y |
248 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 259 | //config: depends on SHELL_HUSH |
249 | //config: help | 260 | //config: help |
250 | //config: Enable support for read-only variables. | 261 | //config: Enable support for read-only variables. |
251 | //config: | 262 | //config: |
252 | //config:config HUSH_KILL | 263 | //config:config HUSH_KILL |
253 | //config: bool "kill builtin (supports kill %jobspec)" | 264 | //config: bool "kill builtin (supports kill %jobspec)" |
254 | //config: default y | 265 | //config: default y |
255 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 266 | //config: depends on SHELL_HUSH |
256 | //config: | 267 | //config: |
257 | //config:config HUSH_WAIT | 268 | //config:config HUSH_WAIT |
258 | //config: bool "wait builtin" | 269 | //config: bool "wait builtin" |
259 | //config: default y | 270 | //config: default y |
260 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 271 | //config: depends on SHELL_HUSH |
261 | //config: | 272 | //config: |
262 | //config:config HUSH_COMMAND | 273 | //config:config HUSH_COMMAND |
263 | //config: bool "command builtin" | 274 | //config: bool "command builtin" |
264 | //config: default y | 275 | //config: default y |
265 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 276 | //config: depends on SHELL_HUSH |
266 | //config: | 277 | //config: |
267 | //config:config HUSH_TRAP | 278 | //config:config HUSH_TRAP |
268 | //config: bool "trap builtin" | 279 | //config: bool "trap builtin" |
269 | //config: default y | 280 | //config: default y |
270 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 281 | //config: depends on SHELL_HUSH |
271 | //config: | 282 | //config: |
272 | //config:config HUSH_TYPE | 283 | //config:config HUSH_TYPE |
273 | //config: bool "type builtin" | 284 | //config: bool "type builtin" |
274 | //config: default y | 285 | //config: default y |
275 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 286 | //config: depends on SHELL_HUSH |
276 | //config: | 287 | //config: |
277 | //config:config HUSH_TIMES | 288 | //config:config HUSH_TIMES |
278 | //config: bool "times builtin" | 289 | //config: bool "times builtin" |
279 | //config: default y | 290 | //config: default y |
280 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 291 | //config: depends on SHELL_HUSH |
281 | //config: | 292 | //config: |
282 | //config:config HUSH_READ | 293 | //config:config HUSH_READ |
283 | //config: bool "read builtin" | 294 | //config: bool "read builtin" |
284 | //config: default y | 295 | //config: default y |
285 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 296 | //config: depends on SHELL_HUSH |
286 | //config: | 297 | //config: |
287 | //config:config HUSH_SET | 298 | //config:config HUSH_SET |
288 | //config: bool "set builtin" | 299 | //config: bool "set builtin" |
289 | //config: default y | 300 | //config: default y |
290 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 301 | //config: depends on SHELL_HUSH |
291 | //config: | 302 | //config: |
292 | //config:config HUSH_UNSET | 303 | //config:config HUSH_UNSET |
293 | //config: bool "unset builtin" | 304 | //config: bool "unset builtin" |
294 | //config: default y | 305 | //config: default y |
295 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 306 | //config: depends on SHELL_HUSH |
296 | //config: | 307 | //config: |
297 | //config:config HUSH_ULIMIT | 308 | //config:config HUSH_ULIMIT |
298 | //config: bool "ulimit builtin" | 309 | //config: bool "ulimit builtin" |
299 | //config: default y | 310 | //config: default y |
300 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 311 | //config: depends on SHELL_HUSH |
301 | //config: | 312 | //config: |
302 | //config:config HUSH_UMASK | 313 | //config:config HUSH_UMASK |
303 | //config: bool "umask builtin" | 314 | //config: bool "umask builtin" |
304 | //config: default y | 315 | //config: default y |
305 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 316 | //config: depends on SHELL_HUSH |
306 | //config: | 317 | //config: |
307 | //config:config HUSH_GETOPTS | 318 | //config:config HUSH_GETOPTS |
308 | //config: bool "getopts builtin" | 319 | //config: bool "getopts builtin" |
309 | //config: default y | 320 | //config: default y |
310 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 321 | //config: depends on SHELL_HUSH |
311 | //config: | 322 | //config: |
312 | //config:config HUSH_MEMLEAK | 323 | //config:config HUSH_MEMLEAK |
313 | //config: bool "memleak builtin (debugging)" | 324 | //config: bool "memleak builtin (debugging)" |
314 | //config: default n | 325 | //config: default n |
315 | //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH | 326 | //config: depends on SHELL_HUSH |
327 | //config: | ||
328 | //config:endif # hush options | ||
316 | 329 | ||
317 | //applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP)) | 330 | //applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP)) |
318 | // APPLET_ODDNAME:name main location suid_type help | 331 | // APPLET_ODDNAME:name main location suid_type help |
319 | //applet:IF_SH_IS_HUSH( APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, hush)) | 332 | //applet:IF_SH_IS_HUSH( APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, hush)) |
320 | //applet:IF_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, hush)) | 333 | //applet:IF_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, hush)) |
321 | 334 | ||
322 | //kbuild:lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o | 335 | //kbuild:lib-$(CONFIG_SHELL_HUSH) += hush.o match.o shell_common.o |
323 | //kbuild:lib-$(CONFIG_SH_IS_HUSH) += hush.o match.o shell_common.o | ||
324 | //kbuild:lib-$(CONFIG_BASH_IS_HUSH) += hush.o match.o shell_common.o | ||
325 | //kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o | 336 | //kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o |
326 | 337 | ||
327 | /* -i (interactive) is also accepted, | 338 | /* -i (interactive) is also accepted, |
diff --git a/util-linux/nologin.c b/util-linux/nologin.c index 5e5e42305..5a8b047a5 100644 --- a/util-linux/nologin.c +++ b/util-linux/nologin.c | |||
@@ -7,7 +7,7 @@ | |||
7 | //config: | 7 | //config: |
8 | //config:config NOLOGIN_DEPENDENCIES | 8 | //config:config NOLOGIN_DEPENDENCIES |
9 | //config: bool "Enable dependencies for nologin" | 9 | //config: bool "Enable dependencies for nologin" |
10 | //config: default y | 10 | //config: default n # Y default makes it harder to select single-applet test |
11 | //config: depends on NOLOGIN | 11 | //config: depends on NOLOGIN |
12 | //config: select CAT | 12 | //config: select CAT |
13 | //config: select ECHO | 13 | //config: select ECHO |