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

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

Issue 1755012: Make modify-image-for-factory scripts more readable. (Closed) Base URL: ssh://git@chromiumos-git/chromiumos
Patch Set: Fix comments 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/mod_for_factory_scripts/factory_setup.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 modify a keyfob-based chromeos system image for testability. 7 # Script to modify a keyfob-based chromeos system image for testability.
8 8
9 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 offset=$(partoffset "${FLAGS_image}" 3) 107 offset=$(partoffset "${FLAGS_image}" 3)
108 108
109 LOOP_DEV=$(sudo losetup -f) 109 LOOP_DEV=$(sudo losetup -f)
110 if [ -z "$LOOP_DEV" ]; then 110 if [ -z "$LOOP_DEV" ]; then
111 echo "No free loop device" 111 echo "No free loop device"
112 exit 1 112 exit 1
113 fi 113 fi
114 sudo losetup -o $(( $offset * 512 )) "${LOOP_DEV}" "${FLAGS_image}" 114 sudo losetup -o $(( $offset * 512 )) "${LOOP_DEV}" "${FLAGS_image}"
115 sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}" 115 sudo mount "${LOOP_DEV}" "${ROOT_FS_DIR}"
116 116
117 MOD_SCRIPTS_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts" 117 MOD_TEST_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_test_scripts"
118 # Run test setup script inside chroot jail to modify the image 118 # Run test setup script to modify the image
119 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \ 119 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \
120 "${MOD_SCRIPTS_ROOT}/test_setup.sh" 120 "${MOD_TEST_ROOT}/test_setup.sh"
121 121
122 # Run manufacturing test setup
123 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then 122 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
124 echo "Modifying image ${FLAGS_image} for manufacturing test..." 123 MOD_FACTORY_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts"
125 124 # Run factory setup script to modify the image
126 echo "Disabling ui.conf, don't do chrome startup on boot." 125 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \
127 sudo mv ${ROOT_FS_DIR}/etc/init/ui.conf \ 126 QUALDB="${FLAGS_qualdb}" "${MOD_FACTORY_ROOT}/factory_setup.sh"
128 ${ROOT_FS_DIR}/etc/init/ui.conf.disabled
129
130 echo "Applying patch to init scripts"
131 MOD_MFG_ROOT="${GCLIENT_ROOT}/src/scripts/mod_for_factory_scripts"
132 pushd ${ROOT_FS_DIR}
133 sudo patch -d ${ROOT_FS_DIR} -p1 < ${MOD_MFG_ROOT}/factory.patch
134 popd
135
136 echo "Modifying Release Description for Factory."
137 FILE="${ROOT_FS_DIR}/etc/lsb-release"
138 sudo sed -i 's/Test/Factory/' $FILE
139
140 echo "Done applying patch."
141
142 # Try to use the sytem component file in the most recent autotest result
143 FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1)
144
145 # Try to append the full path to the file if FLAGS_qualdb is a directory
146 if [ ! -z ${FLAGS_qualdb} ] && [ -d ${FLAGS_qualdb} ]; then
147 # TODO(waihong): Handle multiple results to deliver to multiple images
148 FLAGS_qualdb="${FLAGS_qualdb}/hardware_Components,*"
149 FLAGS_qualdb=$(ls -dt ${FLAGS_qualdb} 2>&-| head -1)
150 FLAGS_qualdb="${FLAGS_qualdb}/hardware_Components/results/system_components"
151 fi
152
153 if [ ! -z ${FLAGS_qualdb} ] && [ -f ${FLAGS_qualdb} ]; then
154 # Copy the qualified component file to the image
155 echo "Copying ${FLAGS_qualdb} to the image."
156 sudo mkdir -p ${ROOT_FS_DIR}/usr/local/manufacturing
157 sudo cp -f ${FLAGS_qualdb} \
158 ${ROOT_FS_DIR}/usr/local/manufacturing/qualified_components
159 else
160 echo "No qualified component file found at: ${FLAGS_qualdb}"
161 fi
162 fi 127 fi
163 128
164 cleanup 129 cleanup
165 trap - EXIT 130 trap - EXIT
166 131
OLDNEW
« no previous file with comments | « src/scripts/mod_for_factory_scripts/factory_setup.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698