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

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

Issue 1736025: Added restart_in_chroot_if_needed to common.sh. (Closed) Base URL: http://src.chromium.org/git/chromiumos.git
Patch Set: Reverted mod_image_for_test.sh and removed line from common.sh. 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/build_tests.sh ('k') | src/scripts/run_tests.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Common constants for build scripts 5 # Common constants for build scripts
6 # This must evaluate properly for both /bin/bash and /bin/sh 6 # This must evaluate properly for both /bin/bash and /bin/sh
7 7
8 # All scripts should die on error unless commands are specifically excepted 8 # All scripts should die on error unless commands are specifically excepted
9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'.
10 # TODO: Re-enable this once shflags is less prone to dying. 10 # TODO: Re-enable this once shflags is less prone to dying.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 # Rebuild the package 201 # Rebuild the package
202 pushd "$TOP_SCRIPT_DIR" 202 pushd "$TOP_SCRIPT_DIR"
203 rm -f ../${PKG_BASE}_*.deb 203 rm -f ../${PKG_BASE}_*.deb
204 dpkg-buildpackage -b -tc -us -uc -j$NUM_JOBS 204 dpkg-buildpackage -b -tc -us -uc -j$NUM_JOBS
205 mv ../${PKG_BASE}_*.deb "$OUT_DIR" 205 mv ../${PKG_BASE}_*.deb "$OUT_DIR"
206 rm ../${PKG_BASE}_*.changes 206 rm ../${PKG_BASE}_*.changes
207 popd 207 popd
208 } 208 }
209 209
210 # Enter a chroot and restart the current script if needed
211 function restart_in_chroot_if_needed {
212 if [ $INSIDE_CHROOT -ne 1 ]
213 then
214 # Equivalent to enter_chroot.sh -- <current command>
215 exec $SCRIPTS_DIR/enter_chroot.sh -- \
216 $CHROOT_TRUNK_DIR/src/scripts/$(basename $0) $*
217 fi
218 }
219
210 # Fail unless we're inside the chroot. This guards against messing up your 220 # Fail unless we're inside the chroot. This guards against messing up your
211 # workstation. 221 # workstation.
212 function assert_inside_chroot { 222 function assert_inside_chroot {
213 if [ $INSIDE_CHROOT -ne 1 ] 223 if [ $INSIDE_CHROOT -ne 1 ]
214 then 224 then
215 echo "This script must be run inside the chroot. Run this first:" 225 echo "This script must be run inside the chroot. Run this first:"
216 echo " $SCRIPTS_DIR/enter_chroot.sh" 226 echo " $SCRIPTS_DIR/enter_chroot.sh"
217 exit 1 227 exit 1
218 fi 228 fi
219 } 229 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 path=${1:?} 355 path=${1:?}
346 shift 356 shift
347 357
348 if ! sudo umount -d "${path}"; then 358 if ! sudo umount -d "${path}"; then
349 warn "Failed to unmount ${path}" 359 warn "Failed to unmount ${path}"
350 warn "Doing a lazy unmount" 360 warn "Doing a lazy unmount"
351 361
352 sudo umount -d -l "${path}" || die "Failed to lazily unmount ${path}" 362 sudo umount -d -l "${path}" || die "Failed to lazily unmount ${path}"
353 fi 363 fi
354 } 364 }
OLDNEW
« no previous file with comments | « src/scripts/build_tests.sh ('k') | src/scripts/run_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698