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>
This commit is contained in:
parent
30348c2058
commit
d80607da4d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue