1#!/bin/sh
2
3# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# A die function to print the message and then exit
8die() {
9  echo -e "$@"
10  exit 1
11}
12
13# Make a directory if it does not exist yet.
14# Remove files in the directory if any.
15make_empty_dir() {
16  local dir="$1"
17  mkdir -p "$dir"
18  rm -fr "$dir"/*
19}
20
21# Source the cros common script
22source_cros_common_script() {
23  CROS_SCRIPT_ROOT="/usr/lib/crosutils"
24  test -d "$CROS_SCRIPT_ROOT" || \
25      die "Path $CROS_SCRIPT_ROOT not found. Make sure you are in chroot."
26  . "${CROS_SCRIPT_ROOT}/common.sh"
27}
28