flatcar-scripts/build_library/test_build_root
Mike Frysinger 2cf2102f99 test_build_root: convert to arrays
Minor code clean up.

BUG=None
TEST=`build_image` still works + boots

Change-Id: I0e26dd3575f963a52d522c4f7c2da8aa5a7dda5c
Reviewed-on: https://gerrit.chromium.org/gerrit/30262
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-08-14 13:38:33 -07:00

50 lines
949 B
Bash
Executable File

#!/bin/bash
# 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.
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
. "${SCRIPT_ROOT}/common.sh" || exit 1
# We're invoked only by build_image, which runs in the chroot
assert_inside_chroot
# Flags
DEFINE_string root "" \
"The root file system to check."
# Parse command line
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
# Die on any errors
switch_to_strict_mode
# Check all parts of a pipe
set -o pipefail
ROOT="$FLAGS_root"
if [[ ! -d "$ROOT" ]]; then
die_notrace "Root FS does not exist ($ROOT)"
fi
ROOT_BINARIES=(
/usr/bin/Xorg
/boot/vmlinuz
/sbin/session_manager
/bin/sed
/opt/google/chrome/chrome
)
EXITCODE=0
for i in "${BINARIES[@]}"; do
i="${ROOT}${i}"
if ! [[ -f $i ]]; then
error "cannot find $i"
EXITCODE=1
fi
done
exit $EXITCODE