mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 22:51:03 +02:00
Learn board type for package_to_live and image_to_target
In both cases move making contact with the remote board to an earlier step and default the "board" option to whatever is reported by the remote. BUG=n0ne TEST=Run without board flag or .default_board Change-Id: I53330ce5ab05b4cff92ac3a384ae0202fc156953 Reviewed-on: http://gerrit.chromium.org/gerrit/433 Reviewed-by: Sam Leffler <sleffler@chromium.org> Tested-by: Paul Stewart <pstew@chromium.org>
This commit is contained in:
parent
986317313b
commit
99e580e21e
@ -605,6 +605,25 @@ def main(argv):
|
||||
if not options.board:
|
||||
options.board = cros_env.GetDefaultBoard()
|
||||
|
||||
if options.remote:
|
||||
cros_env.Info('Contacting client %s' % options.remote)
|
||||
cros_env.SetRemote(options.remote)
|
||||
rel = cros_env.GetRemoteRelease()
|
||||
if not rel:
|
||||
cros_env.Fatal('Could not retrieve remote lsb-release')
|
||||
board = rel.get('CHROMEOS_RELEASE_BOARD', '(None)')
|
||||
if not options.board:
|
||||
options.board = board
|
||||
elif board != options.board and not options.force_mismatch:
|
||||
cros_env.Error('Board %s does not match expected %s' %
|
||||
(board, options.board))
|
||||
cros_env.Error('(Use --force-mismatch option to override this)')
|
||||
cros_env.Fatal()
|
||||
|
||||
elif not options.server_only:
|
||||
parser.error('Either --server-only must be specified or '
|
||||
'--remote=<client> needs to be given')
|
||||
|
||||
if not options.src:
|
||||
options.src = cros_env.GetLatestImage(options.board)
|
||||
if options.src is None:
|
||||
@ -654,23 +673,6 @@ def main(argv):
|
||||
cros_env.Debug("Update file %s" % update_file)
|
||||
cros_env.Debug("Stateful file %s" % stateful_file)
|
||||
|
||||
if options.remote:
|
||||
cros_env.Info('Contacting client %s' % options.remote)
|
||||
cros_env.SetRemote(options.remote)
|
||||
rel = cros_env.GetRemoteRelease()
|
||||
if not rel:
|
||||
cros_env.Fatal('Could not retrieve remote lsb-release')
|
||||
board = rel.get('CHROMEOS_RELEASE_BOARD', '(None)')
|
||||
if board != options.board and not options.force_mismatch:
|
||||
cros_env.Error('Board %s does not match expected %s' %
|
||||
(board, options.board))
|
||||
cros_env.Error('(Use --force-mismatch option to override this)')
|
||||
cros_env.Fatal()
|
||||
|
||||
elif not options.server_only:
|
||||
parser.error('Either --server-only must be specified or '
|
||||
'--remote=<client> needs to be given')
|
||||
|
||||
if (not cros_env.GenerateUpdatePayload(image_file, update_file) or
|
||||
not cros_env.BuildStateful(image_file, image_directory, stateful_file)):
|
||||
cros_env.Fatal()
|
||||
|
@ -62,6 +62,9 @@ if [ -z "${FLAGS_ARGV}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
remote_access_init
|
||||
learn_board
|
||||
|
||||
if [ -z "${FLAGS_board}" ]; then
|
||||
echo "Please specify a board using the --board=MyBoard argument"
|
||||
exit 1
|
||||
@ -70,8 +73,6 @@ fi
|
||||
set -e
|
||||
trap cleanup EXIT
|
||||
|
||||
remote_access_init
|
||||
|
||||
eval set -- "${FLAGS_ARGV}"
|
||||
|
||||
if [ ${FLAGS_build} -eq ${FLAGS_TRUE} ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user