2 * Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * @brief loadenv: Restoring a environment
28 #include <environment.h>
30 static int do_loadenv(struct command
*cmdtp
, int argc
, char *argv
[])
32 char *filename
, *dirname
;
39 filename
= "/dev/env0";
42 printf("loading environment from %s\n", filename
);
43 return envfs_load(filename
, dirname
);
46 static const __maybe_unused
char cmd_loadenv_help
[] =
47 "Usage: loadenv [ENVFS] [DIRECTORY]\n"
48 "Load the persistent storage contained in <envfs> to the directory\n"
50 "If ommitted <directory> defaults to /env and <envfs> defaults to /dev/env0.\n"
51 "Note that envfs can only handle files. Directories are skipped silently.\n";
53 BAREBOX_CMD_START(loadenv
)
55 .usage
= "load environment from persistent storage",
56 BAREBOX_CMD_HELP(cmd_loadenv_help
)
60 * @page loadenv_command loadenv
62 * Usage: loadenv [\<directory>] [\<envfs>]
64 * Load the persistent storage contained in \<envfs> to the directory \<directory>.
66 * If ommitted \<directory> defaults to \c /env and \<envfs> defaults to
69 * @note envfs can only handle files. Directories are skipped silently.