2 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
4 # To be sourced by main script
6 # Shamelessly copied from
7 # https://github.com/facebook/infer/blob/master/scripts/opam_utils.sh
8 # Many thanks to the infer team :D
10 opam_require_version_2
() {
13 { version
=$
(opam
--version 2>/dev
/null
); status
=$?
; }
14 if [ "$status" != 0 ]; then
15 # Suppress Warning: the `` without quotes in the next line is intentional
16 # shellcheck disable=SC2016
17 printf '*** ERROR: `opam --version` failed, please install opam version 2\n' >&2
24 printf '*** ERROR: opam version "%s" is not supported, please install opam version 2\n' "$version" >&2
25 printf '*** NOTE: opam is "%s"\n' "$(command -v opam)" >&2