Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/scripts/make_factory_package.sh

Issue 2132008: Update factory installer, factory test (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: integrate autupdate server changes Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scripts/image_to_usb.sh ('k') | src/scripts/mod_for_factory_scripts/200patchInitScript » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
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
5 # found in the LICENSE file.
6
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
9 # configuration that can be installed using a factory install shim.
10 #
11 # miniomaha lives in src/platform/dev/ and miniomaha partition sets live
12 # in src/platform/dev/static.
13
14 # Load common constants. This should be the first executable line.
15 # The path to common.sh should be relative to your script's location.
16 . "$(dirname "$0")/common.sh"
17
18 # Load functions and constants for chromeos-install
19 . "$(dirname "$0")/chromeos-common.sh"
20
21 get_default_board
22
23 # Flags
24 DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built"
25 DEFINE_string factory "" \
26 "Directory and file containing factory image: /path/chromiumos_test_image.bin"
27 DEFINE_string release "" \
28 "Directory and file containing release image: /path/chromiumos_image.bin"
29
30
31 # Parse command line
32 FLAGS "$@" || exit 1
33 eval set -- "${FLAGS_ARGV}"
34
35 if [ ! -f "${FLAGS_release}" ] ; then
36 echo "Cannot find image file ${FLAGS_release}"
37 exit 1
38 fi
39
40 if [ ! -f "${FLAGS_factory}" ] ; then
41 echo "Cannot find image file ${FLAGS_factory}"
42 exit 1
43 fi
44
45 # Convert args to paths. Need eval to un-quote the string so that shell
46 # chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work.
47 OMAHA_DIR=${SRC_ROOT}/platform/dev
48 OMAHA_DATA_DIR=${OMAHA_DIR}/static/
49
50 if [ ${INSIDE_CHROOT} -eq 0 ]; then
51 echo "Caching sudo authentication"
52 sudo -v
53 echo "Done"
54 fi
55
56 # Use this image as the source image to copy
57 RELEASE_DIR=`dirname ${FLAGS_release}`
58 FACTORY_DIR=`dirname ${FLAGS_factory}`
59 RELEASE_IMAGE=`basename ${FLAGS_release}`
60 FACTORY_IMAGE=`basename ${FLAGS_factory}`
61
62
63 prepare_omaha() {
64 sudo rm -rf ${OMAHA_DATA_DIR}/rootfs-test.gz
65 sudo rm -rf ${OMAHA_DATA_DIR}/rootfs-release.gz
66 rm -rf ${OMAHA_DATA_DIR}/efi.gz
67 rm -rf ${OMAHA_DATA_DIR}/oem.gz
68 rm -rf ${OMAHA_DATA_DIR}/state.gz
69 rm -rf ${OMAHA_DIR}/miniomaha.conf
70 }
71
72 prepare_dir() {
73 sudo rm -rf rootfs-test.gz
74 sudo rm -rf rootfs-release.gz
75 rm -rf efi.gz
76 rm -rf oem.gz
77 rm -rf state.gz
78 }
79
80
81 # Clean up stale config and data files.
82 prepare_omaha
83
84 # Get the release image.
85 pushd ${RELEASE_DIR}
86 echo "Generating omaha release image from ${FLAGS_release}"
87 echo "Generating omaha factory image from ${FLAGS_factory}"
88 echo "Output omaha image to ${OMAHA_DATA_DIR}"
89 echo "Output omaha config to ${OMAHA_DIR}/miniomaha.conf"
90
91 prepare_dir
92
93 sudo ./unpack_partitions.sh ${RELEASE_IMAGE} &> /dev/null
94 release_hash=`sudo ${SCRIPTS_DIR}/mk_memento_images.sh part_2 part_3 \
95 | grep hash | awk '{print $4}'`
96 sudo chmod a+rw update.gz
97 mv update.gz rootfs-release.gz
98 mv rootfs-release.gz ${OMAHA_DATA_DIR}
99 echo "release: ${release_hash}"
100
101 cat part_8 | gzip -9 > oem.gz
102 oem_hash=`cat oem.gz | openssl sha1 -binary | openssl base64`
103 mv oem.gz ${OMAHA_DATA_DIR}
104 echo "oem: ${oem_hash}"
105
106 cat part_12 | gzip -9 > efi.gz
107 efi_hash=`cat efi.gz | openssl sha1 -binary | openssl base64`
108 mv efi.gz ${OMAHA_DATA_DIR}
109 echo "efi: ${efi_hash}"
110
111 popd
112
113 # Go to retrieve the factory test image.
114 pushd ${FACTORY_DIR}
115 prepare_dir
116
117
118 sudo ./unpack_partitions.sh ${FACTORY_IMAGE} &> /dev/null
119 test_hash=`sudo ${SCRIPTS_DIR}//mk_memento_images.sh part_2 part_3 \
120 | grep hash | awk '{print $4}'`
121 sudo chmod a+rw update.gz
122 mv update.gz rootfs-test.gz
123 mv rootfs-test.gz ${OMAHA_DATA_DIR}
124 echo "test: ${test_hash}"
125
126 cat part_1 | gzip -9 > state.gz
127 state_hash=`cat state.gz | openssl sha1 -binary | openssl base64`
128 mv state.gz ${OMAHA_DATA_DIR}
129 echo "state: ${state_hash}"
130
131 echo "
132 config = [
133 {
134 'qual_ids': set([\"${FLAGS_board}\"]),
135 'factory_image': 'rootfs-test.gz',
136 'factory_checksum': '${test_hash}',
137 'release_image': 'rootfs-release.gz',
138 'release_checksum': '${release_hash}',
139 'oempartitionimg_image': 'oem.gz',
140 'oempartitionimg_checksum': '${oem_hash}',
141 'efipartitionimg_image': 'efi.gz',
142 'efipartitionimg_checksum': '${efi_hash}',
143 'stateimg_image': 'state.gz',
144 'stateimg_checksum': '${state_hash}'
145 },
146 ]
147 " > ${OMAHA_DIR}/miniomaha.conf
148
149 popd
150 echo "The miniomaha server lives in src/platform/dev"
151 echo "to validate the configutarion, run:"
152 echo " python2.6 devserver.py --factory_config miniomaha.conf --validate_factor y_config"
153 echo "To run the server:"
154 echo " python2.6 devserver.py --factory_config miniomaha.conf"
OLDNEW
« no previous file with comments | « src/scripts/image_to_usb.sh ('k') | src/scripts/mod_for_factory_scripts/200patchInitScript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698