diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-07-04 23:50:14 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-07-05 20:50:45 +0200 |
commit | 4604923f0c7d4f1954d1cc5dfe0f3a2ef5b9b074 (patch) | |
tree | b18d9dd07ded155726576f4c1091cfd2b23b37db /defaultenv-2 | |
parent | 4561eae51ae7a750d4d215ea6cc6e63c20a6c3e5 (diff) | |
download | barebox-4604923f0c7d4f1954d1cc5dfe0f3a2ef5b9b074.tar.gz barebox-4604923f0c7d4f1954d1cc5dfe0f3a2ef5b9b074.tar.xz |
defenv-2: improve boot script
- add usage information
- add option parsing:
-v verbose
-v -v more verbose
-l list bĀ“possible boot sources
-d dryrun
The dryrun option sets the global variables necessary for booting
but does not actually boot the system. This way it is possible to
make additional adjustments to the boot variables and then invoke
bootm manually.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'defaultenv-2')
-rw-r--r-- | defaultenv-2/base/bin/boot | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/defaultenv-2/base/bin/boot b/defaultenv-2/base/bin/boot index c5ad73dde8..4ebda3f4b2 100644 --- a/defaultenv-2/base/bin/boot +++ b/defaultenv-2/base/bin/boot @@ -1,5 +1,38 @@ #!/bin/sh +verbose= +dryrun= + +usage=" +$0 [OPTIONS] [source]\n + -v verbose\n + -d dryrun\n + -l list boot sources\n + -h help" + +for i in /env/boot/*; do + basename $i s + sources="$sources$s " +done + +while getopt "vdhl" opt; do + if [ ${opt} = v ]; then + if [ -n "$verbose" ]; then + verbose="-v -v" + else + verbose="-v" + fi + elif [ ${opt} = d ]; then + dryrun=1 + elif [ ${opt} = l ]; then + echo -e "boot sources:\n$sources" + exit 0 + elif [ ${opt} = h ]; then + echo -e "$usage" + exit 0 + fi +done + if [ $# = 0 ]; then scr="$global.boot.default" else @@ -8,11 +41,14 @@ fi if [ -n "$scr" ]; then if [ ! -f /env/boot/$scr ]; then - echo -e "/env/boot/$scr does not exist.\nValid choices:" - ls /env/boot + echo -e "/env/boot/$scr does not exist.Valid choices:\n$sources" exit fi /env/boot/$scr fi -bootm +if [ -n "$dryrun" ]; then + exit 0 +fi + +bootm $verbose |