From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/3] defaultenv: add login autoboot support
Date: Thu, 11 Aug 2011 09:31:32 +0200 [thread overview]
Message-ID: <20110811073132.GC31404@pengutronix.de> (raw)
In-Reply-To: <1312973230-27870-3-git-send-email-plagnioj@jcrosoft.com>
On Wed, Aug 10, 2011 at 12:47:10PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> if the login command is enable and a password set use login with timeout
> to stop the boot
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> common/Makefile | 10 ++++++----
> defaultenv/common/bin/boot_timeout | 10 ++++++++++
> defaultenv/common/bin/init | 9 +--------
> defaultenv/login/bin/boot_timeout | 15 +++++++++++++++
> 4 files changed, 32 insertions(+), 12 deletions(-)
> create mode 100644 defaultenv/common/bin/boot_timeout
> create mode 100644 defaultenv/login/bin/boot_timeout
>
> diff --git a/common/Makefile b/common/Makefile
> index 531000a..5eeb944 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -32,19 +32,21 @@ $(obj)/startup.o: include/generated/barebox_default_env.h
> $(obj)/env.o: include/generated/barebox_default_env.h
>
> ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> -DEFAULT_ENVIRONMENT_PATH = "defaultenv/common"
> +DEFAULT_ENVIRONMENT_PATH-y = "defaultenv/common"
> +
> +DEFAULT_ENVIRONMENT_PATH-$(CONFIG_CMD_LOGIN) += "defaultenv/login"
> endif
>
> ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
> -DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
> +DEFAULT_ENVIRONMENT_PATH-y += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
> endif
>
> -ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f '{}' \;; done)
> +ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH-y); do find $${i} -type f -exec readlink -f '{}' \;; done)
>
> endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
>
> barebox_default_env: $(ENV_FILES)
> - $(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH)
> + $(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH-y)
>
> include/generated/barebox_default_env.h: barebox_default_env
> $(Q)cat $< | $(objtree)/scripts/bin2c default_environment > $@
I don't like this approach. It is quite intrusive and it handles only
one variable (CONFIG_CMD_LOGIN). If we by applying this patch tell
people that this is the way to customize the default env then this
is going to be a mess soon.
I think you have to live with overwriting /env/bin/init in your board
specific env or have to come up with a more general way to adjust
the default environment.
Sascha
> diff --git a/defaultenv/common/bin/boot_timeout b/defaultenv/common/bin/boot_timeout
> new file mode 100644
> index 0000000..a469ef3
> --- /dev/null
> +++ b/defaultenv/common/bin/boot_timeout
> @@ -0,0 +1,10 @@
> +. /env/config
> +
> +echo
> +echo -n "Hit any key to stop autoboot: "
> +timeout -a $autoboot_timeout
> +if [ $? != 0 ]; then
> + exit
> +fi
> +
> +boot
> diff --git a/defaultenv/common/bin/init b/defaultenv/common/bin/init
> index b66f7d9..5c4ea00 100644
> --- a/defaultenv/common/bin/init
> +++ b/defaultenv/common/bin/init
> @@ -24,11 +24,4 @@ if [ -f /env/bin/init_board ]; then
> /env/bin/init_board
> fi
>
> -echo
> -echo -n "Hit any key to stop autoboot: "
> -timeout -a $autoboot_timeout
> -if [ $? != 0 ]; then
> - exit
> -fi
> -
> -boot
> +boot_timeout
> diff --git a/defaultenv/login/bin/boot_timeout b/defaultenv/login/bin/boot_timeout
> new file mode 100644
> index 0000000..96a7690
> --- /dev/null
> +++ b/defaultenv/login/bin/boot_timeout
> @@ -0,0 +1,15 @@
> +. /env/config
> +
> +echo
> +echo -n "Login in ${autoboot_timeout}s to stop autoboot: "
> +echo
> +login -t $autoboot_timeout
> +
> +echo
> +echo -n "Hit any key to stop autoboot: "
> +timeout -a $autoboot_timeout
> +if [ $? != 0 ]; then
> + exit
> +fi
> +
> +boot
> --
> 1.7.5.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-08-11 7:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-10 10:47 [PATCH 1/3] login: add timeout support Jean-Christophe PLAGNIOL-VILLARD
2011-08-10 10:47 ` [PATCH 2/3] defaultenv: move common env to defaultenv/common Jean-Christophe PLAGNIOL-VILLARD
2011-08-10 10:47 ` [PATCH 3/3] defaultenv: add login autoboot support Jean-Christophe PLAGNIOL-VILLARD
2011-08-11 7:31 ` Sascha Hauer [this message]
2011-08-11 15:11 ` Jean-Christophe PLAGNIOL-VILLARD
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=20110811073132.GC31404@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=plagnioj@jcrosoft.com \
/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