Browse Source

add choices for both the root login shell and /bin/sh

Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
Thorsten Glaser 13 years ago
parent
commit
c76fbbb7e8
2 changed files with 105 additions and 0 deletions
  1. 31 0
      mk/image.mk
  2. 74 0
      target/config/Config.in.runtime

+ 31 - 0
mk/image.mk

@@ -1,6 +1,34 @@
 # This file is part of the OpenADK project. OpenADK is copyrighted
 # material, please see the LICENCE file in the top-level directory.
 
+# relative paths, like 'mksh' or '../usr/bin/foosh'
+ifeq (${ADK_BINSH_ASH},y)
+BINSH:=ash
+else ifeq (${ADK_BINSH_BASH},y)
+BINSH:=bash
+else ifeq (${ADK_BINSH_MKSH},y)
+BINSH:=mksh
+else ifeq (${ADK_BINSH_ZSH},y)
+BINSH:=zsh
+else
+$(error No /bin/sh configured!)
+endif
+
+# absolute paths
+ifeq (${ADK_ROOTSH_ASH},y)
+ROOTSH:=/bin/ash
+else ifeq (${ADK_ROOTSH_BASH},y)
+ROOTSH:=/bin/bash
+else ifeq (${ADK_ROOTSH_MKSH},y)
+ROOTSH:=/bin/mksh
+else ifeq (${ADK_ROOTSH_TCSH},y)
+ROOTSH:=/usr/bin/tcsh
+else ifeq (${ADK_ROOTSH_ZSH},y)
+ROOTSH:=/bin/zsh
+else
+$(error No login shell configured!)
+endif
+
 imageprepare: image-prepare-post extra-install
 
 # if an extra directory exist in TOPDIR, copy all content over the 
@@ -20,6 +48,9 @@ image-prepare-post:
 			mkfontdir ${TARGET_DIR}/usr/share/fonts/X11/$${i}; \
 		done; \
 	fi
+	sed -i '/^root:/s!:/bin/sh$$!:${ROOTSH}!' ${TARGET_DIR}/etc/passwd
+	-rm -f ${TARGET_DIR}/bin/sh
+	ln -sf ${BINSH} ${TARGET_DIR}/bin/sh
 
 KERNEL_PKGDIR:=$(LINUX_BUILD_DIR)/kernel-pkg
 KERNEL_PKG:=$(PACKAGE_DIR)/kernel_$(KERNEL_VERSION)_$(CPU_ARCH).$(PKG_SUFFIX)

+ 74 - 0
target/config/Config.in.runtime

@@ -66,3 +66,77 @@ config ADK_RUNTIME_KBD_LAYOUT
 	depends on ADK_TARGET_WITH_INPUT
 	help
 	  Predefine the keyboard layout for the embedded system.
+
+choice
+prompt "Initial login shell for the root user"
+default ADK_ROOTSH_ASH
+
+config ADK_ROOTSH_ASH
+	select BUSYBOX_ASH
+	bool "ash (busybox)"
+	help
+	  Use the minimalistic ash variant that is part of busybox
+	  as standard login shell for the superuser. This is the
+	  default, but discouraged due to its frugality.
+
+config ADK_ROOTSH_BASH
+	select ADK_PACKAGE_BASH
+	bool "bash (GNU Bourne-Again Shell)"
+	help
+	  Use GNU bash as standard login shell for the superuser.
+
+config ADK_ROOTSH_MKSH
+	select ADK_PACKAGE_MKSH
+	bool "mksh (MirBSD Korn Shell)"
+	help
+	  Use mksh (a Korn Shell variant) as standard login shell
+	  for the superuser.
+
+config ADK_ROOTSH_TCSH
+	select ADK_PACKAGE_TCSH
+	bool "tcsh (Tenex C Shell)"
+	help
+	  Use tcsh (a C Shell variant) as standard login shell
+	  for the superuser.
+
+config ADK_ROOTSH_ZSH
+	select ADK_PACKAGE_ZSH
+	bool "zsh (The Z Shell)"
+	help
+	  Use zsh as standard login shell for the superuser.
+
+endchoice
+
+choice
+prompt "System /bin/sh (POSIX script shell)"
+default ADK_BINSH_ASH
+
+config ADK_BINSH_ASH
+	select BUSYBOX_ASH
+	bool "ash (busybox)"
+	help
+	  Use the minimalistic ash variant that is part of busybox
+	  as system shell. This is the default and rather small and
+	  fast, but lacks scripting features.
+
+config ADK_BINSH_BASH
+	select ADK_PACKAGE_BASH
+	bool "bash (GNU Bourne-Again Shell)"
+	help
+	  Use GNU bash as system shell. This is discouraged due to
+	  its size and slowness.
+
+config ADK_BINSH_MKSH
+	select ADK_PACKAGE_MKSH
+	bool "mksh (MirBSD Korn Shell)"
+	help
+	  Use mksh (a Korn Shell variant) as system shell, which is
+	  both small and powerful, so quite suited for this task.
+
+config ADK_BINSH_ZSH
+	select ADK_PACKAGE_ZSH
+	bool "zsh (The Z Shell)"
+	help
+	  Use zsh as system shell. This is probably a bad idea.
+
+endchoice