Skip to contentSkip to conversation

system: add option to choose what /bin/sh points to

RFC PATCH New Yann E. MORIN 2 participants 2 messages Oct 12, 2014

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 system: add option to choose what /bin/sh points to

Not all our shells do install a pointer to /bin/sh. Besides, between those that do and multiple ones are enabled, the last one to install wins the the symlink.

Add a new config choice in the system sub-menu that allows the user to explicitly select the shell to provide /bin/sh. If busybox is not enabled, default to using dash, a POSIX shell.

Remove the symlink creation from bash.mk at the same time.

Note: for every shell, we select them, except busybox, on which we depend, on the assumption that we do not want to force busybox in case the user decided not to enable it.

Cc Gustavo Zacarias <[email protected]>
Cc Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- default to dash if busybox is disabled

---
 package/bash/bash.mk |  1 -
 system/Config.in     | 44 ++++++++++++++++++++++++++++++++++++++++++++
 system/system.mk     | 12 ++++++++++++
 3 files changed, 56 insertions(+), 1 deletion(-)
package/bash/bash.mk +0 -1
index 6510af5..34a3a73 100644
@@ -35,7 +35,6 @@ define BASH_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		DESTDIR=$(TARGET_DIR) exec_prefix=/ install
 	rm -f $(TARGET_DIR)/bin/bashbug
-	ln -sf bash $(TARGET_DIR)/bin/sh
 endef
 
 $(eval $(autotools-package))
system/Config.in +44 -0

50 lines not on this page · raw message

system/system.mk +12 -0
index b614615..5802e2d 100644
@@ -2,6 +2,7 @@ TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
 TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE))
 TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD))
 TARGET_GENERIC_PASSWD_METHOD = $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD))
+TARGET_GENERIC_BIN_SH = $(call qstrip,$(BR2_SYSTEM_BIN_SH))
 TARGET_GENERIC_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT))
 TARGET_GENERIC_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE))
 TARGET_GENERIC_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM))
@@ -46,6 +47,17 @@ define SYSTEM_ROOT_PASSWD
 endef
 TARGET_FINALIZE_HOOKS += SYSTEM_ROOT_PASSWD
 
+ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
+define SYSTEM_BIN_SH
+	rm -f $(TARGET_DIR)/bin/sh
+endef
+else
+define SYSTEM_BIN_SH
+	ln -sf $(TARGET_GENERIC_BIN_SH) $(TARGET_DIR)/bin/sh
+endef
+endif
+TARGET_FINALIZE_HOOKS += SYSTEM_BIN_SH
+
 ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
 ifeq ($(BR2_PACKAGE_SYSVINIT),y)
 # In sysvinit inittab, the "id" must not be longer than 4 bytes, so we
Signature · 1 line
1.9.1
#1 lore raw

RFC PATCH 1/1 system: add option to choose what /bin/sh points to

Quoted 25 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Not all our shells do install a pointer to /bin/sh. Besides, between those that do and multiple ones are enabled, the last one to install wins the the symlink.

Add a new config choice in the system sub-menu that allows the user to explicitly select the shell to provide /bin/sh. If busybox is not enabled, default to using dash, a POSIX shell.

Remove the symlink creation from bash.mk at the same time.

Note: for every shell, we select them, except busybox, on which we depend, on the assumption that we do not want to force busybox in case the user decided not to enable it.

Cc Gustavo Zacarias <[email protected]>
Cc Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- default to dash if busybox is disabled

system/Config.in +1 -0
+config BR2_SYSTEM_BIN_SH_BASH

system/Config.in config BR2_TARGET_GENERIC_ROOT_PASSWD · line 235

Quoted 10 lines
system/Config.in +10 -0
+	bool "bash"
+	depends on BR2_USE_MMU # bash
+	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS || !BR2_PACKAGE_BUSYBOX
+	select BR2_PACKAGE_BASH
+
+config BR2_SYSTEM_BIN_SH_DASH
+	bool "dash"
+	depends on BR2_USE_MMU # dash
+	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS || !BR2_PACKAGE_BUSYBOX
+	select BR2_PACKAGE_DASH

You forgot to remove the redundant || !BR2_PACKAGE_BUSYBOX.

Committed with that fixed, thanks.

Signature · 1 line
Bye, Peter Korsgaard