diff options
author | Tristan Corrick <tristan@corrick.kiwi> | 2018-12-31 20:54:42 +1300 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-01-03 16:53:32 +0000 |
commit | d80607da4d540a27b9f30e665de696a903a9375e (patch) | |
tree | 01f4d28ce4ab0eb112bec08d5bb3b730a56d514c /util/chromeos | |
parent | 30348c2058e926b3991888a7bc3d84445c0fe7cc (diff) |
util/chromeos/crosfirmware.sh: Check for dependencies
crosfirmware.sh has dependencies that might not be installed on some
systems. If a dependency is missing, provide a clear message about the
issue and how to resolve it.
Change-Id: I265bd03666f1273d3c22b60aae860c48c758005b
Signed-off-by: Tristan Corrick <tristan@corrick.kiwi>
Reviewed-on: https://review.coreboot.org/c/30549
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/chromeos')
-rwxr-xr-x | util/chromeos/crosfirmware.sh | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/util/chromeos/crosfirmware.sh b/util/chromeos/crosfirmware.sh index 0d3c40a281..16ab24774c 100755 --- a/util/chromeos/crosfirmware.sh +++ b/util/chromeos/crosfirmware.sh @@ -14,9 +14,6 @@ # GNU General Public License for more details. # -# This script needs -# * sharutils - #DEBUG=1 # On some systems, `parted` and `debugfs` are located in /sbin. @@ -27,6 +24,28 @@ debug() test "$DEBUG" == "1" && echo "$*" } +exit_if_uninstalled() { + local cmd_name="$1" + local deb_pkg_name="$2" + + if type "$cmd_name" >/dev/null 2>&1; then + return + fi + + printf '`%s` was not found. ' "$cmd_name" >&2 + printf 'On Debian-based systems, it can be installed\n' >&2 + printf 'by running `apt install %s`.\n' "$deb_pkg_name" >&2 + + exit 1 +} + +exit_if_dependencies_are_missing() { + exit_if_uninstalled "uudecode" "sharutils" + exit_if_uninstalled "debugfs" "e2fsprogs" + exit_if_uninstalled "parted" "parted" + exit_if_uninstalled "curl" "curl" +} + get_inventory() { _conf=$1 @@ -113,6 +132,8 @@ do_one_board() BOARD=$1 +exit_if_dependencies_are_missing + if [ "$BOARD" == "all" ]; then CONF=$( mktemp ) get_inventory $CONF |