Commit Graph

5 Commits

Author SHA1 Message Date
David James
359d3e119d Simplify boilerplate common.sh code in src/scripts.
Currently, the scripts in src/scripts have multiple implementations
for handling when common.sh fails to load, some of which are buggy.
To simplify the boilerplate, these scripts now just exit if common.sh
fails to load. The shell itself will print the following message if
common.sh is not found:
  /usr/lib/crosutils/common.sh: No such file or directory

BUG=chromium-os:32442
TEST=Run these scripts with and without common.sh installed.

Change-Id: Ie54420b6c649774f9cb039c14c80f4cf6c6ebc07
Reviewed-on: https://gerrit.chromium.org/gerrit/27058
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
2012-07-12 10:55:37 -07:00
Mike Frysinger
6b1abb2a6f fix up function style
The "function" keyword is superfluous, not in POSIX, is inconsistent
between bash files, and generally makes me angry.  So convert every
instance to the form:
	foo() {

BUG=None
TEST=`cbuildbot x86-generic-paladin` works

Change-Id: I97f5ca30a3edfef7222b1e08ac23917dc613b556
Reviewed-on: https://gerrit.chromium.org/gerrit/22467
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-05-11 14:10:38 -07:00
Mike Frysinger
7cd3c285d2 run_chroot_version_hooks: sanity check for multiple upgrades hooks
If people land upgrade hooks of the same version levels independently and
no one notices, we get into an inconsistent state where only one of the
hooks actually runs.  Add a sanity check so we bail rather than upgrading
the chroot with an arbitrarily picked script.

BUG=None
TEST=run build_packages with multiple 17_xxx files in a ver 16 chroot and see script error out
TEST=run build_packages with single 17_xxx file in a ver 16 chroot and see successful run

Change-Id: If9a71f60badb7c9643c1a03ad49bb23ffb64f341
Reviewed-on: https://gerrit.chromium.org/gerrit/11972
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2011-11-20 15:22:24 -08:00
Brian Harring
d5d5dbffa1 Fix/standardize exiting if common.sh can't be found
The problem here is that most were doing their exiting w/in a subshell;
exit within a subshell kills the subshell, not the parent.  Not all scripts
were using set -e (which would pick up the failing subshell); as such
just rewriting them to remove the potential via eliminateing the subshelling.

Beyond that, removed a couple of custom (working, although non-standard)
approaches, and removed a duplicate common.sh sourc'ing w/in mk_memento_images.sh

TEST=force 'find_common_sh' to fail, note the scripts fails to exit
BUG=none

Change-Id: Ia1108a091a6399ad6aedd3cade4a107f4411686c
Reviewed-on: http://gerrit.chromium.org/gerrit/3905
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2011-07-22 12:06:59 -07:00
Zdenek Behan
25b6f07b7c chroot_upgrade: rename things before it's too late
The name chroot_upgrade is rather confusing since we already have
"chroot_update" and those two scripts will be chained. It was the
original name before update_chroot existed.

BUG=none
TEST=run the new one, see it work the same

Change-Id: I851fc4a0f28e32a9bbd01b2e4ddedbaffc6abf1c
Reviewed-on: http://gerrit.chromium.org/gerrit/876
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Zdenek Behan <zbehan@chromium.org>
2011-05-13 15:36:10 -07:00