OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Script to generate a factory install partition set and miniomaha.conf | 7 # Script to generate a factory install partition set and miniomaha.conf |
8 # file from a release image and a factory image. This creates a server | 8 # file from a release image and a factory image. This creates a server |
9 # configuration that can be installed using a factory install shim. | 9 # configuration that can be installed using a factory install shim. |
10 # | 10 # |
11 # miniomaha lives in src/platform/dev/ and miniomaha partition sets live | 11 # miniomaha lives in src/platform/dev/ and miniomaha partition sets live |
12 # in src/platform/dev/static. | 12 # in src/platform/dev/static. |
13 | 13 |
14 # Load common constants. This should be the first executable line. | 14 # --- BEGIN COMMON.SH BOILERPLATE --- |
15 # The path to common.sh should be relative to your script's location. | 15 # Load common CrOS utilities. Inside the chroot this file is installed in |
16 . "$(dirname "$0")/common.sh" | 16 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 17 # location. |
| 18 find_common_sh() { |
| 19 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 20 local path |
| 21 |
| 22 SCRIPT_ROOT= |
| 23 for path in "${common_paths[@]}"; do |
| 24 if [ -r "${path}/common.sh" ]; then |
| 25 SCRIPT_ROOT=${path} |
| 26 break |
| 27 fi |
| 28 done |
| 29 } |
| 30 |
| 31 find_common_sh |
| 32 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 33 # --- END COMMON.SH BOILERPLATE --- |
| 34 |
| 35 # Need to be inside the chroot to load chromeos-common.sh |
| 36 assert_inside_chroot |
17 | 37 |
18 # Load functions and constants for chromeos-install | 38 # Load functions and constants for chromeos-install |
19 . "$(dirname "$0")/chromeos-common.sh" | 39 . "/usr/lib/installer/chromeos-common.sh" || \ |
| 40 die "Unable to load /usr/lib/installer/chromeos-common.sh" |
20 | 41 |
21 # Load functions designed for image processing | 42 # Load functions designed for image processing |
22 . "$(dirname "$0")/lib/cros_image_common.sh" || | 43 . "${SCRIPT_ROOT}/lib/cros_image_common.sh" || |
23 die "Cannot load required library: lib/cros_image_common.sh; Abort." | 44 die "Cannot load required library: lib/cros_image_common.sh; Abort." |
24 | 45 |
25 get_default_board | 46 get_default_board |
26 | 47 |
27 # Flags | 48 # Flags |
28 DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built" | 49 DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built" |
29 DEFINE_string factory "" \ | 50 DEFINE_string factory "" \ |
30 "Directory and file containing factory image: /path/chromiumos_test_image.bin" | 51 "Directory and file containing factory image: /path/chromiumos_test_image.bin" |
31 DEFINE_string firmware_updater "" \ | 52 DEFINE_string firmware_updater "" \ |
32 "If set, include the firmware shellball into the server configuration" | 53 "If set, include the firmware shellball into the server configuration" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 To run the server: | 417 To run the server: |
397 python2.6 devserver.py --factory_config miniomaha.conf" | 418 python2.6 devserver.py --factory_config miniomaha.conf" |
398 } | 419 } |
399 | 420 |
400 # Main | 421 # Main |
401 if [ -n "$FLAGS_diskimg" ]; then | 422 if [ -n "$FLAGS_diskimg" ]; then |
402 generate_img | 423 generate_img |
403 else | 424 else |
404 generate_omaha | 425 generate_omaha |
405 fi | 426 fi |
OLD | NEW |