Check in tofactory script.

Also refactor the other scripts to move more common functions (debug output, etc.) to common.sh.

BUG=chrome-os-partner:1903
TEST=manual; ran on a Chrome notebook, verified the right things got copied.

Review URL: http://codereview.chromium.org/5878005

Change-Id: Ib7131356ecb6f88eee3d529a518f23b94756d0c0
This commit is contained in:
Randall Spangler
2011-01-04 16:42:08 -08:00
parent ddc06e4be1
commit e37ff5d596
4 changed files with 279 additions and 89 deletions

View File

@@ -26,7 +26,6 @@ DEFINE_boolean force_backup \
$FLAGS_TRUE "Create backup even if source is not live" ""
DEFINE_string backup_dir \
"$DEFAULT_BACKUP_FOLDER" "Path of directory to store firmware backups" ""
DEFINE_boolean debug $FLAGS_FALSE "Provide debug messages" "d"
# Parse command line
FLAGS "$@" || exit 1
@@ -44,23 +43,6 @@ EXEC_LOG="$(make_temp_file)"
# Functions
# ----------------------------------------------------------------------------
# Reports error message and exit(1)
err_die() {
echo "ERROR: $*" 1>&2
exit 1
}
# Returns true if we're running in debug mode
is_debug_mode() {
[ "$FLAGS_debug" = $FLAGS_TRUE ]
}
# Prints messages (in parameters) in debug mode
debug_msg() {
if is_debug_mode; then
echo "DEBUG: $*" 1>&2
fi
}
# Reads $IMAGE from $FLAGS_from
read_image() {