xref: /aosp_15_r20/external/pigweed/pw_env_setup/post-checkout-hook-helper.sh (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1#!/bin/bash
2# Copyright 2022 The Pigweed Authors
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may not
5# use this file except in compliance with the License. You may obtain a copy of
6# the License at
7#
8#     https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations under
14# the License.
15
16# If we're not in a bootstrapped shell exit immediately. We won't know where
17# the config file is.
18if [ -z "$PW_PROJECT_ROOT" ]; then
19  exit 0
20fi
21
22set -o errexit
23set -o nounset
24set -o pipefail
25
26echo -n "Updating CIPD packages..."
27
28"$PW_ROOT/pw_env_setup/py/pw_env_setup/env_setup.py" \
29  --project-root "$PW_PROJECT_ROOT" \
30  --pw-root "$PW_ROOT" \
31  --config-file "$_PW_ENVIRONMENT_CONFIG_FILE" \
32  --shell-file "$_PW_ACTUAL_ENVIRONMENT_ROOT/unused.sh" \
33  --install-dir "$_PW_ACTUAL_ENVIRONMENT_ROOT" \
34  --quiet \
35  --trust-cipd-hash \
36  --skip-submodule-check \
37  --cipd-only
38
39echo "done."
40