xref: /aosp_15_r20/external/gsc-utils/util/explain_aprov.sh (revision 4f2df630800bdcf1d4f0decf95d8a1cb87344f5f)
1#!/bin/bash
2# Copyright 2023 The ChromiumOS Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5#
6# Wrapper script for retrieving and interpreting AP RO verification status of
7# a ChromeOS device connected to the host over CCD.
8
9set -uo pipefail
10
11PROGRAM="explain_ap_ro_verification_status"
12if ! command -v "${PROGRAM}" > /dev/null 2>&1; then
13  echo "The '${PROGRAM}' utility is not installed, run update_chroot"
14  exit 1
15fi
16
17status="$(gsctool -W 2>&1 | awk '/expanded_aprov_status:/ {print "0x"$2}' )"
18# shellcheck disable=SC2181
19if [[ $? != 0 ]]; then
20  echo "Failed to retrieve status, is your DUT CCD connected?" >&2
21  exit 1
22fi
23
24"${PROGRAM}" "${status}"
25