[git commit master] shell: make it possible to alias one of shells to "bash"

Denys Vlasenko vda.linux at googlemail.com
Thu May 20 01:39:43 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=40477e2fdb3d32f4d368ee4f7c72ded4a2398082
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
packed_usage                                       27047   27054      +7
applet_names                                        2227    2232      +5
applet_main                                         1304    1308      +4
applet_nameofs                                       652     654      +2
applet_install_loc                                   163     164      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 19/0)               Total: 19 bytes

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 include/applets.h |    2 ++
 include/usage.h   |    2 ++
 shell/Config.in   |   43 +++++++++++++++++++++++++++++++++----------
 3 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/include/applets.h b/include/applets.h
index 36b2485..ff8799c 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -79,6 +79,8 @@ IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_DROP))
 IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP))
 IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk))
 IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename))
+IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash))
+IF_FEATURE_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, _BB_DIR_BIN, _BB_SUID_DROP, bash))
 IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP))
 //IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP))
 IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP))
diff --git a/include/usage.h b/include/usage.h
index 3fce939..a295ab8 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -123,6 +123,8 @@
 #define lash_full_usage ""
 #define msh_trivial_usage NOUSAGE_STR
 #define msh_full_usage ""
+#define bash_trivial_usage NOUSAGE_STR
+#define bash_full_usage ""
 
 #define awk_trivial_usage \
        "[OPTIONS] [AWK_PROGRAM] [FILE]..."
diff --git a/shell/Config.in b/shell/Config.in
index cf599df..286a341 100644
--- a/shell/Config.in
+++ b/shell/Config.in
@@ -6,11 +6,11 @@
 menu "Shells"
 
 choice
-	prompt "Choose your default shell"
+	prompt "Choose which shell is aliased to 'sh' name"
 	default FEATURE_SH_IS_NONE
 	help
-	  Choose a shell. The ash shell is the most bash compatible
-	  and full featured one.
+	  Choose which shell you want to be executed by 'sh' alias.
+	  The ash shell is the most bash compatible and full featured one.
 
 config FEATURE_SH_IS_ASH
 	select ASH
@@ -21,15 +21,38 @@ config FEATURE_SH_IS_HUSH
 	select HUSH
 	bool "hush"
 
-####config FEATURE_SH_IS_LASH
-####	select LASH
-####	bool "lash"
+config FEATURE_SH_IS_NONE
+	bool "none"
 
-####config FEATURE_SH_IS_MSH
-####	select MSH
-####	bool "msh"
+endchoice
 
-config FEATURE_SH_IS_NONE
+choice
+	prompt "Choose which shell is aliased to 'bash' name"
+	default FEATURE_BASH_IS_NONE
+	help
+	  Choose which shell you want to be executed by 'bash' alias.
+	  The ash shell is the most bash compatible and full featured one.
+
+	  Note that selecting this option does not switch on any bash
+	  compatibility code. It merely makes it possible to install
+	  /bin/bash (sym)link and run scripts which start with
+	  #!/bin/bash line.
+
+	  Many systems use it in scripts which use bash-specific features,
+	  even simple ones like $RANDOM. Without this option, busybox
+	  can't be used for running them because it won't recongnize
+	  "bash" as a supported applet name.
+
+config FEATURE_BASH_IS_ASH
+	select ASH
+	bool "ash"
+	depends on !NOMMU
+
+config FEATURE_BASH_IS_HUSH
+	select HUSH
+	bool "hush"
+
+config FEATURE_BASH_IS_NONE
 	bool "none"
 
 endchoice
-- 
1.6.3.3



More information about the busybox-cvs mailing list