summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-27 10:14:38 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 18:43:53 +0200
commit0c7436753c73e71ee512e5ed8029e7ccceedcd89 (patch)
treecc1524b0abc4c016968cef8989408f0680eed548 /commands
parenta081eb840ed12eff6256a5497771a8c3168fc95b (diff)
downloadbarebox-0c7436753c73e71ee512e5ed8029e7ccceedcd89.tar.gz
barebox-0c7436753c73e71ee512e5ed8029e7ccceedcd89.tar.xz
state: Allow to load without authentification
Sometimes it's useful to be able to load a state even when it can't be authentificated. Add an option for this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/state.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/commands/state.c b/commands/state.c
index aded6e71e2..c57a906ff0 100644
--- a/commands/state.c
+++ b/commands/state.c
@@ -23,8 +23,9 @@ static int do_state(int argc, char *argv[])
struct state *state = NULL;
int do_save = 0, do_load = 0;
const char *statename = "state";
+ int no_auth = 0;
- while ((opt = getopt(argc, argv, "sl")) > 0) {
+ while ((opt = getopt(argc, argv, "sln")) > 0) {
switch (opt) {
case 's':
do_save = 1;
@@ -32,6 +33,9 @@ static int do_state(int argc, char *argv[])
case 'l':
do_load = 1;
break;
+ case 'n':
+ no_auth = 1;
+ break;
default:
return COMMAND_ERROR_USAGE;
}
@@ -51,10 +55,14 @@ static int do_state(int argc, char *argv[])
return -ENOENT;
}
- if (do_load)
- ret = state_load(state);
- else if (do_save)
+ if (do_load) {
+ if (no_auth)
+ ret = state_load_no_auth(state);
+ else
+ ret = state_load(state);
+ } else if (do_save) {
ret = state_save(state);
+ }
return ret;
}