summaryrefslogtreecommitdiff
path: root/meta/files
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-09 22:13:36 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-10 14:49:47 +0000
commit8c49ab40c2ff2e60b717f479822d1a0021735429 (patch)
tree2e4c459f263c41202cf3aa11a34476303d96d525 /meta/files
parent6486dd71c6c9977e5d67fd803d1bd85001654b5a (diff)
downloadopenembedded-core-8c49ab40c2ff2e60b717f479822d1a0021735429.tar.gz
openembedded-core-8c49ab40c2ff2e60b717f479822d1a0021735429.tar.bz2
openembedded-core-8c49ab40c2ff2e60b717f479822d1a0021735429.zip
toolchain-shar-extract.sh: Ensure sbin directories are in PATH in clean environment
For the PATH host tool whitelisting to work, the sbin directories need to be in PATH. In the cleaned SDK environment on some distros, this isn't the case and the SDK would then fail to setup there. This adds code to add such paths if they do happen to be missing, ugly, but unblocks the PATH whitelisting which I believe to be important. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/files')
-rw-r--r--meta/files/toolchain-shar-extract.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 3f54c96cc0..91804ec281 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -8,6 +8,20 @@
[ -f /etc/environment ] && . /etc/environment
export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'`
+tweakpath () {
+ case ":${PATH}:" in
+ *:"$1":*)
+ ;;
+ *)
+ PATH=$PATH:$1
+ esac
+}
+
+# Some systems don't have /usr/sbin or /sbin in the cleaned environment PATH but we make need it
+# for the system's host tooling checks
+tweakpath /usr/sbin
+tweakpath /sbin
+
INST_ARCH=$(uname -m | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
SDK_ARCH=$(echo @SDK_ARCH@ | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")