From 4e7d8b8bce5cf8d3d1d7813e5e15579cbe8198ea Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Mon, 15 Jun 2020 18:25:10 +0200
Subject: [PATCH] [build] Do not install rustup whether Rust is already
 installed

by the distribution package manager

Use 'command -v' to know if an executable is present in the PATH
There is an error with 'rustup' not found, but that's fine
---
 neon/build.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/neon/build.sh b/neon/build.sh
index a67b9e596..e0789be52 100755
--- a/neon/build.sh
+++ b/neon/build.sh
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 if [ -z "${DUNITER_FAST_BUILD}" ]; then
-    if [ -e "${HOME}/.cargo/bin/rustup" ]; then
+    if [ "$(command -v rustup)" ]; then
         rustup update stable
-    else
+    elif [ ! "$(command -v cargo)" ]; then
         curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
         export PATH="$HOME/.cargo/bin:$PATH"
     fi
-- 
GitLab