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 # |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 echo "Done" | 79 echo "Done" |
80 fi | 80 fi |
81 | 81 |
82 # Use this image as the source image to copy | 82 # Use this image as the source image to copy |
83 RELEASE_DIR="$(dirname "${FLAGS_release}")" | 83 RELEASE_DIR="$(dirname "${FLAGS_release}")" |
84 FACTORY_DIR="$(dirname "${FLAGS_factory}")" | 84 FACTORY_DIR="$(dirname "${FLAGS_factory}")" |
85 RELEASE_IMAGE="$(basename "${FLAGS_release}")" | 85 RELEASE_IMAGE="$(basename "${FLAGS_release}")" |
86 FACTORY_IMAGE="$(basename "${FLAGS_factory}")" | 86 FACTORY_IMAGE="$(basename "${FLAGS_factory}")" |
87 | 87 |
88 prepare_img() { | 88 prepare_img() { |
89 local outdev="$FLAGS_diskimg" | 89 local outdev="$(readlink -f "$FLAGS_diskimg")" |
Nick Sanders
2011/01/13 06:54:08
I don't think this will work. The issue is not sym
Hung-Te
2011/01/13 07:05:51
Right, but readlink -f reports full path.
| |
90 local sectors="$FLAGS_sectors" | 90 local sectors="$FLAGS_sectors" |
91 local force_full="true" | 91 local force_full="true" |
92 | 92 |
93 # We'll need some code to put in the PMBR, for booting on legacy BIOS. | 93 # We'll need some code to put in the PMBR, for booting on legacy BIOS. |
94 echo "Fetch PMBR" | 94 echo "Fetch PMBR" |
95 local pmbrcode="$(mktemp -d)/gptmbr.bin" | 95 local pmbrcode="$(mktemp -d)/gptmbr.bin" |
96 sudo dd bs=512 count=1 if="${FLAGS_release}" of="${pmbrcode}" status=noxfer | 96 sudo dd bs=512 count=1 if="${FLAGS_release}" of="${pmbrcode}" status=noxfer |
97 | 97 |
98 echo "Prepare base disk image" | 98 echo "Prepare base disk image" |
99 # Create an output file if requested, or if none exists. | 99 # Create an output file if requested, or if none exists. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 IMAGE_IS_UNPACKED= | 184 IMAGE_IS_UNPACKED= |
185 else | 185 else |
186 #TODO(hungte) Currently we run unpack_partitions.sh if part_tools are not | 186 #TODO(hungte) Currently we run unpack_partitions.sh if part_tools are not |
187 # found. If the format of unpack_partitions.sh is reliable, we can prevent | 187 # found. If the format of unpack_partitions.sh is reliable, we can prevent |
188 # creating temporary files. See image_part_offset for more information. | 188 # creating temporary files. See image_part_offset for more information. |
189 echo "WARNING: cannot find partition tools. Using unpack_partitions.sh." >&2 | 189 echo "WARNING: cannot find partition tools. Using unpack_partitions.sh." >&2 |
190 IMAGE_IS_UNPACKED=1 | 190 IMAGE_IS_UNPACKED=1 |
191 fi | 191 fi |
192 | 192 |
193 generate_img() { | 193 generate_img() { |
194 local outdev="$FLAGS_diskimg" | 194 local outdev="$(readlink -f "$FLAGS_diskimg")" |
195 local sectors="$FLAGS_sectors" | 195 local sectors="$FLAGS_sectors" |
196 | 196 |
197 prepare_img | 197 prepare_img |
198 | 198 |
199 # Get the release image. | 199 # Get the release image. |
200 pushd "${RELEASE_DIR}" >/dev/null | 200 pushd "${RELEASE_DIR}" >/dev/null |
201 | 201 |
202 echo "Release Kernel" | 202 echo "Release Kernel" |
203 image_partition_copy "${RELEASE_IMAGE}" 2 "${outdev}" 4 | 203 image_partition_copy "${RELEASE_IMAGE}" 2 "${outdev}" 4 |
204 | 204 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 To run the server: | 358 To run the server: |
359 python2.6 devserver.py --factory_config miniomaha.conf" | 359 python2.6 devserver.py --factory_config miniomaha.conf" |
360 } | 360 } |
361 | 361 |
362 # Main | 362 # Main |
363 if [ -n "$FLAGS_diskimg" ]; then | 363 if [ -n "$FLAGS_diskimg" ]; then |
364 generate_img | 364 generate_img |
365 else | 365 else |
366 generate_omaha | 366 generate_omaha |
367 fi | 367 fi |
OLD | NEW |