diff options
author | Andrei Gherzan <andrei@gherzan.ro> | 2012-09-20 12:56:59 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-20 13:33:50 +0100 |
commit | 42d91a7db404bacc50541e1813c537d9c260ffb4 (patch) | |
tree | 5ffa8dd4259197731192f3e6b2d47fc93b3c2f62 /meta/classes/populate_sdk_base.bbclass | |
parent | 82a08d42ffddc4d955706ebe2e0078134574a6ba (diff) | |
download | poky-42d91a7db404bacc50541e1813c537d9c260ffb4.tar.gz |
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>
Diffstat (limited to 'meta/classes/populate_sdk_base.bbclass')
-rw-r--r-- | meta/classes/populate_sdk_base.bbclass | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass index 1c151d7186..2bff41f9e6 100644 --- a/meta/classes/populate_sdk_base.bbclass +++ b/meta/classes/populate_sdk_base.bbclass | |||
@@ -118,7 +118,7 @@ fakeroot create_shar() { | |||
118 | 118 | ||
119 | DEFAULT_INSTALL_DIR="${SDKPATH}" | 119 | DEFAULT_INSTALL_DIR="${SDKPATH}" |
120 | 120 | ||
121 | echo -n "Enter target directory for Poky SDK (default: $DEFAULT_INSTALL_DIR): " | 121 | printf "Enter target directory for Poky SDK (default: $DEFAULT_INSTALL_DIR): " |
122 | read target_sdk_dir | 122 | read target_sdk_dir |
123 | 123 | ||
124 | if [ "$target_sdk_dir" = "" ]; then | 124 | if [ "$target_sdk_dir" = "" ]; then |
@@ -128,7 +128,7 @@ fi | |||
128 | eval target_sdk_dir=$target_sdk_dir | 128 | eval target_sdk_dir=$target_sdk_dir |
129 | target_sdk_dir=$(readlink -m $target_sdk_dir) | 129 | target_sdk_dir=$(readlink -m $target_sdk_dir) |
130 | 130 | ||
131 | echo -n "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?" | 131 | printf "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?" |
132 | read answer | 132 | read answer |
133 | 133 | ||
134 | if [ "$answer" = "" ]; then | 134 | if [ "$answer" = "" ]; then |
@@ -148,11 +148,11 @@ fi | |||
148 | 148 | ||
149 | payload_offset=$(($(grep -na -m1 "^MARKER:$" $(basename $0)|cut -d':' -f1) + 1)) | 149 | payload_offset=$(($(grep -na -m1 "^MARKER:$" $(basename $0)|cut -d':' -f1) + 1)) |
150 | 150 | ||
151 | echo -n "Extracting SDK..." | 151 | printf "Extracting SDK..." |
152 | tail -n +$payload_offset $(basename $0) | tar xj --strip-components=4 -C $target_sdk_dir | 152 | tail -n +$payload_offset $(basename $0) | tar xj --strip-components=4 -C $target_sdk_dir |
153 | echo "done" | 153 | echo "done" |
154 | 154 | ||
155 | echo -n "Setting it up..." | 155 | printf "Setting it up..." |
156 | # fix environment paths | 156 | # fix environment paths |
157 | env_setup_script=$(find $target_sdk_dir -name "environment-setup-${REAL_MULTIMACH_TARGET_SYS}") | 157 | env_setup_script=$(find $target_sdk_dir -name "environment-setup-${REAL_MULTIMACH_TARGET_SYS}") |
158 | sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script | 158 | sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script |