]> code.ossystems Code Review - openembedded-core.git/commitdiff
toolchain-shar-extract.sh: Ensure sbin directories are in PATH in clean environment
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 9 Mar 2017 22:13:36 +0000 (22:13 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 10 Mar 2017 14:49:47 +0000 (14:49 +0000)
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>
meta/files/toolchain-shar-extract.sh

index 3f54c96cc04c188ccc28826dfe38670a18dd7613..91804ec281860089ab62d87ded26a092a0cdae9a 100644 (file)
@@ -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/")