1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 00:59:48 +00:00

Replace "echo -e" with "printf" to have the same behavior in dash or bash

oe-core removed the prerequisite to have sh as bash. POSIX doesn't define
any options and furthermore allows 'echo -e' to be the default behavior.
This means that in dash 'echo -e' will actually print '-e' and interpret
backslashes by default. We use instead 'printf' builtin command with or
without '\n' to simulate 'echo -e' or 'echo -n'.
'printf' needs format while 'echo' can be used without any arguments. So
'echo >' was replaced by 'printf "" >'.
'echo' without '-n' flag adds a new line by default so to keep the same
behavior of two new lines while using 'echo "\n"', 'printf "\n\n"' is
used.

[YOCTO #3138]

(From OE-Core rev: a19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3)

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Andrei Gherzan
2012-09-20 12:56:59 +03:00
committed by Richard Purdie
parent 82a08d42ff
commit 42d91a7db4
11 changed files with 26 additions and 26 deletions
+4 -4
View File
@@ -118,7 +118,7 @@ fakeroot create_shar() {
DEFAULT_INSTALL_DIR="${SDKPATH}"
echo -n "Enter target directory for Poky SDK (default: $DEFAULT_INSTALL_DIR): "
printf "Enter target directory for Poky SDK (default: $DEFAULT_INSTALL_DIR): "
read target_sdk_dir
if [ "$target_sdk_dir" = "" ]; then
@@ -128,7 +128,7 @@ fi
eval target_sdk_dir=$target_sdk_dir
target_sdk_dir=$(readlink -m $target_sdk_dir)
echo -n "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?"
printf "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?"
read answer
if [ "$answer" = "" ]; then
@@ -148,11 +148,11 @@ fi
payload_offset=$(($(grep -na -m1 "^MARKER:$" $(basename $0)|cut -d':' -f1) + 1))
echo -n "Extracting SDK..."
printf "Extracting SDK..."
tail -n +$payload_offset $(basename $0) | tar xj --strip-components=4 -C $target_sdk_dir
echo "done"
echo -n "Setting it up..."
printf "Setting it up..."
# fix environment paths
env_setup_script=$(find $target_sdk_dir -name "environment-setup-${REAL_MULTIMACH_TARGET_SYS}")
sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script