populate_sdk_base, adt_installer_internal: fix issue on older distributions

This patch addresses an SDK installer issue on older distributions if
the installation takes place in another directory than the default one. In
fact, is all about the 'file' utility version used for determining if a
file is a text file. For example, for a perl script, newer 'file' versions
return:
"...script, ASCII text executable"
while older versions return:
"...script text executable"
Hence the regex pattern didn't match the scripts.

Also the patch contains two unrelated minor fixes:
 * return an exit code of 1 instead of -1 when installation machine is
   not supported. That because on an older distribution we also get this
   error message: "exit: 9: Illegal number: -1";
 * remove unnecessary $SUDO_EXEC prefix to grep;

[YOCTO #3538]

(From OE-Core rev: e7e23a1e5aae4028e21e37ec09e9d431a9adfbcb)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Laurentiu Palcu 2012-12-06 15:16:32 +02:00 committed by Richard Purdie
parent 0b5772c7f9
commit ade680a28f
2 changed files with 3 additions and 3 deletions

View File

@ -123,7 +123,7 @@ SDK_ARCH=$(echo ${SDK_ARCH} | sed -e "s/i[5-6]86/ix86/")
if [ "$INST_ARCH" != "$SDK_ARCH" ]; then
echo "Error: Installation machine not supported!"
exit -1
exit 1
fi
DEFAULT_INSTALL_DIR="${SDKPATH}"
@ -233,7 +233,7 @@ if [ $? -ne 0 ]; then
fi
# replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc
$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|$SUDO_EXEC grep ":.*ASCII.*text"|cut -d':' -f1|$SUDO_EXEC xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g"
$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\).*text"|cut -d':' -f1|$SUDO_EXEC xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g"
# change all symlinks pointing to ${SDKPATH}
for l in $($SUDO_EXEC find $native_sysroot -type l); do

View File

@ -212,7 +212,7 @@ check_result
env_setup_script=$(find $NATIVE_INSTALL_DIR/ -name "environment-setup-*")
$SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g" $env_setup_script
find $OECORE_NATIVE_SYSROOT -type f -exec file '{}' \;|grep ":.*ASCII.*text"|cut -d':' -f1|\
find $OECORE_NATIVE_SYSROOT -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\).*text"|cut -d':' -f1|\
xargs $SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g"
# change all symlinks pointing to /opt/${DISTRO}/${SDK_VERSION}