summaryrefslogtreecommitdiffstats
path: root/kickstart-static64.sh
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-05-27 22:00:45 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-05-27 22:00:45 +0300
commit0779db3b5d0f3cc10934ca22ba71ef142b0672a2 (patch)
tree18d9bb2b5842b2a08e1a8be0be303c78d5e90596 /kickstart-static64.sh
parente8164dbd905c1753e2cab43bcd7dc369f03d98e3 (diff)
sudo when not running as root
Diffstat (limited to 'kickstart-static64.sh')
-rwxr-xr-xkickstart-static64.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/kickstart-static64.sh b/kickstart-static64.sh
index db0fda162c..981c261286 100755
--- a/kickstart-static64.sh
+++ b/kickstart-static64.sh
@@ -30,8 +30,16 @@ if [ $? -ne 0 ]
echo >&2 "Failed to download the latest static binary version of netdata."
exit 1
fi
-chmod 755 "/tmp/${LATEST}"
echo >&2 "Executing the downloaded self-extracting archive"
-sudo sh "/tmp/${LATEST}"
+sudo=
+[ "${UID}" != "0" ] && sudo="sudo"
+${sudo} sh "/tmp/${LATEST}"
+
+if [ $? -eq 0 ]
+ then
+ rm "/tmp/${LATEST}"
+else
+ echo >&2 "Did not remove: /tmp/${LATEST}"
+fi