| #!/usr/bin/env bash | 
 | # Copyright 2023 The Fuchsia Authors. All rights reserved. | 
 | # Use of this source code is governed by a BSD-style license that can be | 
 | # found in the LICENSE file. | 
 |  | 
 | set -eu -o pipefail | 
 |  | 
 | install_dir=$1 | 
 |  | 
 | mkdir -p "$install_dir" | 
 |  | 
 | # Use flock to ensure that only one `cipd ensure` process can be running at a | 
 | # time. | 
 | # TODO(olivernewman): Delete this script and call `cipd ensure` directly from | 
 | # Starlark once shac supports idempotent setup steps for checks. | 
 | flock "$install_dir/cipd-ensure.lock" \ | 
 |   cipd ensure \ | 
 |   -log-level error \ | 
 |   -ensure-file shac.ensure \ | 
 |   -root "$install_dir" |