From a9b099f715b7555ae7696befecf6545abe6a498d Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Mon, 15 Jun 2020 17:46:03 +0200
Subject: [PATCH 1/2] [build] Change neon/build.sh script

Move 'then' keywords after the condition for better readability
Remove useless directory change at the end of the script
Move "cd neon" close to the related build calls
---
 neon/build.sh | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/neon/build.sh b/neon/build.sh
index 19c59a84f..a67b9e596 100755
--- a/neon/build.sh
+++ b/neon/build.sh
@@ -1,11 +1,7 @@
 #!/bin/sh
 
-cd neon
-
-if [ -z "${DUNITER_FAST_BUILD}" ]
-then
-    if [ -e "${HOME}/.cargo/bin/rustup" ]
-    then
+if [ -z "${DUNITER_FAST_BUILD}" ]; then
+    if [ -e "${HOME}/.cargo/bin/rustup" ]; then
         rustup update stable
     else
         curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
@@ -19,11 +15,10 @@ else
     echo "WARNING: you have disabled the automatic update of Rust, remember to update Rust regularly with command \"rustup update\"."
 fi
 
-if [ "${NEON_BUILD_RELEASE}" = "true" ] || [ "${NODE_ENV}" = "production" ]
-then
-	neon build --release
+cd neon
+
+if [ "${NEON_BUILD_RELEASE}" = "true" ] || [ "${NODE_ENV}" = "production" ]; then
+    neon build --release
 else
     neon build
 fi
-
-cd ..
\ No newline at end of file
-- 
GitLab


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 2/2] [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