From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 5/5] defaultenv-2: add login support
Date: Mon, 16 Sep 2013 19:50:00 +0200 [thread overview]
Message-ID: <1379353800-28237-5-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1379353800-28237-1-git-send-email-plagnioj@jcrosoft.com>
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>
---
defaultenv-2/base/bin/init | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/defaultenv-2/base/bin/init b/defaultenv-2/base/bin/init
index ca02ba6..81b3434 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}
--
1.8.4.rc1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-09-16 17:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 17:48 [PATCH 0/5 v3] " Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:49 ` [PATCH 1/5] globalvar: add globalvar_add_simple_int/bool/enum/ip support Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:49 ` [PATCH 2/5] login: add globalvar timeout support Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:49 ` [PATCH 3/5] login: disable input console if password wrong Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:49 ` [PATCH 4/5] login/passwd: add default password support Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:50 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-09-18 7:25 ` [PATCH 0/5 v3] defaultenv-2: add login support Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379353800-28237-5-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox