summaryrefslogtreecommitdiffstats
path: root/defaultenv-2
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-09-16 19:50:00 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-19 08:49:51 +0200
commit61694c93cd9e47e2ea72d9095817040a4c0c2cee (patch)
treeb17929fa27e7f59812b7be0890d28af3af817abd /defaultenv-2
parent892c00584937426742a79b12243776a54980c087 (diff)
downloadbarebox-61694c93cd9e47e2ea72d9095817040a4c0c2cee.tar.gz
barebox-61694c93cd9e47e2ea72d9095817040a4c0c2cee.tar.xz
defaultenv-2: add login support
request password to login is a timeout is specified and /env/etc/passwd present ensure we have not console access execpt when allowed Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'defaultenv-2')
-rw-r--r--defaultenv-2/base/bin/init18
1 files changed, 18 insertions, 0 deletions
diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init
index ca02ba6427..81b3434913 100644
--- a/defaultenv-2/base/bin/init
+++ b/defaultenv-2/base/bin/init
@@ -16,14 +16,24 @@ global editcmd=sedit
[ -e /env/config-board ] && /env/config-board
/env/config
+# request password to login if a timeout is specified and password set
+if [ -n ${global.login.timeout} ]; then
+ [ ${global.login.timeout} -gt 0 ] && login_cmd=login
+fi
+# allow the input if not
+[ -n ${global.console.input_allow} ] && global.console.input_allow=1
+
# allow to stop the boot before execute the /env/init/*
# but without waiting
timeout -s -a -v key 0
if [ "${key}" = "q" ]; then
+ ${login_cmd}
exit
fi
+[ -n ${login_cmd} ] && global.console.input_allow=0
+
for i in /env/init/*; do
. $i
done
@@ -34,10 +44,15 @@ else
echo -e -n "\nHit any key to stop autoboot: "
fi
+[ -n ${login_cmd} ] && global.console.input_allow=1
+
timeout -a $global.autoboot_timeout -v key
autoboot="$?"
+[ -n ${login_cmd} ] && global.console.input_allow=0
+
if [ "${key}" = "q" ]; then
+ ${login_cmd}
exit
fi
@@ -46,9 +61,12 @@ if [ "$autoboot" = 0 ]; then
fi
if [ -e /env/menu ]; then
+ ${login_cmd}
if [ "${key}" != "m" ]; then
echo -e "\ntype exit to get to the menu"
sh
fi
/env/menu/mainmenu
fi
+
+${login_cmd}