Avoid trying to install svgbob when already installed

This commit is contained in:
Michael Vines
2018-11-26 15:40:39 -08:00
parent c7f678688d
commit 58e3dd4cb6

View File

@ -13,15 +13,20 @@ _() {
} }
maybe_install() { maybe_install() {
for cmd in "$@"; do declare cmd=$1
set +e declare crate=$2
"$cmd" --help > /dev/null 2>&1
declare exitcode=$? if [[ -z $crate ]]; then
set -e crate=$cmd
if [[ $exitcode -ne 0 ]]; then fi
_ cargo install "$cmd"
fi set +e
done "$cmd" --help > /dev/null 2>&1
declare exitcode=$?
set -e
if [[ $exitcode -ne 0 ]]; then
_ cargo install "$crate"
fi
} }
_ cargo build --all --verbose _ cargo build --all --verbose
@ -47,7 +52,7 @@ done
# Build the HTML # Build the HTML
export PATH=$CARGO_HOME/bin:$PATH export PATH=$CARGO_HOME/bin:$PATH
maybe_install mdbook maybe_install mdbook
maybe_install svgbob_cli maybe_install svgbob svgbob_cli
_ make -C book _ make -C book
echo --- ci/localnet-sanity.sh echo --- ci/localnet-sanity.sh