From 3d2b6ede41c82f9fd0494ab486ec79a7b3bf6129 Mon Sep 17 00:00:00 2001 From: arturgontijo Date: Thu, 5 Mar 2020 09:38:33 -0300 Subject: [PATCH] [scripts] Using sudo only if necessary. --- scripts/installdaemon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/installdaemon b/scripts/installdaemon index 7dbb0358..3fe36e66 100755 --- a/scripts/installdaemon +++ b/scripts/installdaemon @@ -6,4 +6,5 @@ SNETD_VERSION=`curl -s https://api.github.com/repos/singnet/snet-daemon/releases echo 'version' $SNETD_VERSION wget https://github.com/singnet/snet-daemon/releases/download/${SNETD_VERSION}/snet-daemon-${SNETD_VERSION}-linux-amd64.tar.gz tar -xvf snet-daemon-${SNETD_VERSION}-linux-amd64.tar.gz -sudo mv snet-daemon-${SNETD_VERSION}-linux-amd64/snetd /usr/bin/snetd +WITH_SUDO=$([ "$EUID" != 0 ] && echo "sudo" || echo "") +$WITH_SUDO mv snet-daemon-${SNETD_VERSION}-linux-amd64/snetd /usr/bin/snetd