flatcar-scripts/chroot_version_hooks.d/44_fix_gerrit_chrome
Ryan Cui e09d3c2fd5 Upgrade hook v44 fixes
- do test for chromium/src before fixing the checkout.
- don't switch manifests for minilayout users.

BUG=chromium-os:32963
TEST=locally

Change-Id: I1d0cbfc9f4f03d85b34810cdb98d99a7a21d8adf
Reviewed-on: https://gerrit.chromium.org/gerrit/28842
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
Commit-Ready: Ryan Cui <rcui@chromium.org>
2012-07-31 16:07:36 -07:00

37 lines
1.1 KiB
Plaintext

# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Move users of CHROME_ORIGIN=GERRIT_SOURCE to the new gerrit-source.xml
# manifest, as well as setting up the chromium/src repository properly for
# submodules. crosbug.com/32963.
# We only want to run this hook once. Since this also gets called from
# enter_chroot, look for the marker.
MARKER="/tmp/44_fix_gerrit_chrome"
if [ -e "${MARKER}" ]; then
exit 0
fi
chrome_workon="=chromeos-base/chromeos-chrome-9999"
cros_workon_dir="${HOME}/trunk/.config/cros_workon/*"
manifest="${HOME}/trunk/.repo/manifest.xml"
if grep -q "${chrome_workon}" ${cros_workon_dir} &> /dev/null; then
if [ $(readlink "${manifest}") != "manifests/minilayout.xml" ]; then
repo selfupdate && repo init -m gerrit-source.xml
fi
fi
chromium_dir="${HOME}/trunk/chromium/src"
if [ -d "${chromium_dir}" ]; then
(
cd "${chromium_dir}"
ignore_cmd='git config -f $toplevel/.git/config submodule.$name.ignore all'
git submodule foreach "${ignore_cmd}" &> /dev/null
)
fi
touch "${MARKER}"
exit 0