summaryrefslogtreecommitdiffstats
path: root/netdata-installer.sh
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-01-05 03:35:41 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2018-01-05 03:35:41 +0200
commita7cf8d3934be710893a0316b020afd19448494f4 (patch)
treed43a3100e4b434b2515032a5d2302fb18609021d /netdata-installer.sh
parentcafaf427feac2fcfb8ecb1c8eda168d16568085c (diff)
avoid magnifying PATH
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-xnetdata-installer.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh
index 41fc856abc..9a37faee51 100755
--- a/netdata-installer.sh
+++ b/netdata-installer.sh
@@ -1,6 +1,20 @@
#!/usr/bin/env bash
export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
+uniquepath() {
+ local path=""
+ while read
+ do
+ if [[ ! "${path}" =~ (^|:)"${REPLY}"(:|$) ]]
+ then
+ [ ! -z "${path}" ] && path="${path}:"
+ path="${path}${REPLY}"
+ fi
+ done < <( echo "${PATH}" | tr ":" "\n" )
+
+ [ ! -z "${path}" ] && [[ "${PATH}" =~ /bin ]] && [[ "${PATH}" =~ /sbin ]] && export PATH="${path}"
+}
+uniquepath
netdata_source_dir="$(pwd)"
installer_dir="$(dirname "${0}")"