]> code.ossystems Code Review - openembedded-core.git/commitdiff
toolchain-shar-extract: Add post-relocate scripts
authorJoshua Watt <jpewhacker@gmail.com>
Mon, 12 Feb 2018 16:52:07 +0000 (10:52 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 15 Feb 2018 13:24:10 +0000 (13:24 +0000)
Recipes can now install post-relocation scripts which will be run when
the SDK is installed.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/toolchain-scripts.bbclass
meta/files/toolchain-shar-extract.sh
meta/recipes-core/meta/meta-environment.bb

index 9bcfe708c7c62a3dbf1d7fff81f4e8b0ee99c71a..eeb320d15a8e129e034c7ff3c83867c6a7d76b0b 100644 (file)
@@ -116,6 +116,21 @@ fi
 EOF
 }
 
+toolchain_create_post_relocate_script() {
+       script=$1
+       rm -f $script
+       touch $script
+
+    cat >> $script <<EOF
+if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
+    for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*.sh; do
+        \$s "\$1"
+    done
+    rm -rf "${SDKPATHNATIVE}/post-relocate-setup.d"
+fi
+EOF
+}
+
 #we get the cached site config in the runtime
 TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d)}"
 TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
index 91804ec281860089ab62d87ded26a092a0cdae9a..f7ab43066fb9448ea96c629fe72e528d406bf485 100644 (file)
@@ -259,6 +259,14 @@ if [ $savescripts = 0 ] ; then
        $SUDO_EXEC rm -f ${env_setup_script%/*}/relocate_sdk.py ${env_setup_script%/*}/relocate_sdk.sh
 fi
 
+# Execute post-relocation script
+post_relocate="$target_sdk_dir/post-relocate-setup.sh"
+if [ -e "$post_relocate" ]; then
+       $SUDO_EXEC sed -e "s:@SDKPATH@:$target_sdk_dir:g" -i $post_relocate
+       $SUDO_EXEC /bin/sh $post_relocate "$target_sdk_dir" "@SDKPATH@"
+       $SUDO_EXEC rm -f $post_relocate
+fi
+
 echo "SDK has been successfully set up and is ready to be used."
 echo "Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g."
 for env_setup_script in `ls $target_sdk_dir/environment-setup-*`; do
index 29da121a3a967808ee64d39bc77eaef71d150698..09f757a087c5895345476e2bce4d4e7e03cfc3bf 100644 (file)
@@ -55,6 +55,8 @@ create_sdk_files() {
 
        # Add version information
        toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
+
+       toolchain_create_post_relocate_script ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh
 }
 
 do_install() {