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>
This commit is contained in:
parent
892c005849
commit
61694c93cd
|
@ -16,14 +16,24 @@ global editcmd=sedit
|
||||||
[ -e /env/config-board ] && /env/config-board
|
[ -e /env/config-board ] && /env/config-board
|
||||||
/env/config
|
/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/*
|
# allow to stop the boot before execute the /env/init/*
|
||||||
# but without waiting
|
# but without waiting
|
||||||
timeout -s -a -v key 0
|
timeout -s -a -v key 0
|
||||||
|
|
||||||
if [ "${key}" = "q" ]; then
|
if [ "${key}" = "q" ]; then
|
||||||
|
${login_cmd}
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -n ${login_cmd} ] && global.console.input_allow=0
|
||||||
|
|
||||||
for i in /env/init/*; do
|
for i in /env/init/*; do
|
||||||
. $i
|
. $i
|
||||||
done
|
done
|
||||||
|
@ -34,10 +44,15 @@ else
|
||||||
echo -e -n "\nHit any key to stop autoboot: "
|
echo -e -n "\nHit any key to stop autoboot: "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -n ${login_cmd} ] && global.console.input_allow=1
|
||||||
|
|
||||||
timeout -a $global.autoboot_timeout -v key
|
timeout -a $global.autoboot_timeout -v key
|
||||||
autoboot="$?"
|
autoboot="$?"
|
||||||
|
|
||||||
|
[ -n ${login_cmd} ] && global.console.input_allow=0
|
||||||
|
|
||||||
if [ "${key}" = "q" ]; then
|
if [ "${key}" = "q" ]; then
|
||||||
|
${login_cmd}
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -46,9 +61,12 @@ if [ "$autoboot" = 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e /env/menu ]; then
|
if [ -e /env/menu ]; then
|
||||||
|
${login_cmd}
|
||||||
if [ "${key}" != "m" ]; then
|
if [ "${key}" != "m" ]; then
|
||||||
echo -e "\ntype exit to get to the menu"
|
echo -e "\ntype exit to get to the menu"
|
||||||
sh
|
sh
|
||||||
fi
|
fi
|
||||||
/env/menu/mainmenu
|
/env/menu/mainmenu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
${login_cmd}
|
||||||
|
|
Loading…
Reference in New Issue