[OE-core] [PATCH 2/3] toolchain-shar-extract.sh: better default install path for extensible SDK

brendan.le.foll at intel.com brendan.le.foll at intel.com
Wed Aug 19 13:32:44 UTC 2015


From: Brendan Le Foll <brendan.le.foll at intel.com>

Extensible SDK cannot be installed as root so by default offer to install it in
user's home directory under distro/distro_version replacing the normal SDK
version '+' char with a '_' as that's a restricted character for bitbake

Signed-off-by: Brendan Le Foll <brendan.le.foll at intel.com>
---
 meta/files/toolchain-shar-extract.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 6984e11..c4c2a70 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -73,6 +73,19 @@ fi
 
 @SDK_PRE_INSTALL_COMMAND@
 
+# SDK_EXTENSIBLE is exposed from the SDK_PRE_INSTALL_COMMAND above
+if [ "$SDK_EXTENSIBLE" = "1" ]; then
+        if [ ! -w "$DEFAULT_INSTALL_DIR" ]; then
+		# if we can't write to dir then make a new default in /home/$(whoami)
+		# replace any illegal chars with a sensible one
+		DEFAULT_INSTALL_DIR="~/$(echo "@SDK_TITLE@" | cut -d " " -f1)/$(echo $(basename $DEFAULT_INSTALL_DIR) | tr "+ @" _)"
+		# reset target_sdk_dir in case of answer="Y"
+		if [ "$answer" = "Y" ]; then
+			target_sdk_dir="$DEFAULT_INSTALL_DIR"
+		fi
+	fi
+fi
+
 if [ "$target_sdk_dir" = "" ]; then
 	read -e -p "Enter target directory for SDK (default: $DEFAULT_INSTALL_DIR): " target_sdk_dir
 	[ "$target_sdk_dir" = "" ] && target_sdk_dir=$DEFAULT_INSTALL_DIR
@@ -149,7 +162,7 @@ echo "done"
 printf "Setting it up..."
 # fix environment paths
 for env_setup_script in `ls $target_sdk_dir/environment-setup-*`; do
-	$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script
+	$SUDO_EXEC sed -e "s:@SDKPATH@:$target_sdk_dir:g" -i $env_setup_script
 done
 
 @SDK_POST_INSTALL_COMMAND@
-- 
2.5.0




More information about the Openembedded-core mailing list