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:
parent
82a08d42ff
commit
42d91a7db4
|
@ -293,13 +293,13 @@ buildhistory_get_image_installed() {
|
||||||
# Change delimiter from pipe to -> and set style for recommend lines
|
# Change delimiter from pipe to -> and set style for recommend lines
|
||||||
sed -i -e 's:|: -> :' -e 's:\[REC\]:[style=dotted]:' -e 's:$:;:' ${BUILDHISTORY_DIR_IMAGE}/depends.tmp
|
sed -i -e 's:|: -> :' -e 's:\[REC\]:[style=dotted]:' -e 's:$:;:' ${BUILDHISTORY_DIR_IMAGE}/depends.tmp
|
||||||
# Add header, sorted and de-duped contents and footer and then delete the temp file
|
# Add header, sorted and de-duped contents and footer and then delete the temp file
|
||||||
echo -e "digraph depends {\n node [shape=plaintext]" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot
|
printf "digraph depends {\n node [shape=plaintext]\n" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot
|
||||||
cat ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | sort | uniq >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot
|
cat ${BUILDHISTORY_DIR_IMAGE}/depends.tmp | sort | uniq >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot
|
||||||
echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot
|
echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot
|
||||||
rm ${BUILDHISTORY_DIR_IMAGE}/depends.tmp
|
rm ${BUILDHISTORY_DIR_IMAGE}/depends.tmp
|
||||||
|
|
||||||
# Produce installed package sizes list
|
# Produce installed package sizes list
|
||||||
echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp
|
printf "" > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp
|
||||||
cat $pkgcache | while read pkg pkgfile
|
cat $pkgcache | while read pkg pkgfile
|
||||||
do
|
do
|
||||||
if [ -f $pkgfile ] ; then
|
if [ -f $pkgfile ] ; then
|
||||||
|
@ -330,7 +330,7 @@ buildhistory_get_imageinfo() {
|
||||||
( cd ${IMAGE_ROOTFS} && find . -ls | awk '{ if ( $7 ~ /[0-9]/ ) printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, $7, $11, $12, $13 ; else printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, 0, $10, $11, $12 }' | sort -k5 > ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt )
|
( cd ${IMAGE_ROOTFS} && find . -ls | awk '{ if ( $7 ~ /[0-9]/ ) printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, $7, $11, $12, $13 ; else printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, 0, $10, $11, $12 }' | sort -k5 > ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt )
|
||||||
|
|
||||||
# Record some machine-readable meta-information about the image
|
# Record some machine-readable meta-information about the image
|
||||||
echo -n > ${BUILDHISTORY_DIR_IMAGE}/image-info.txt
|
printf "" > ${BUILDHISTORY_DIR_IMAGE}/image-info.txt
|
||||||
cat >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt <<END
|
cat >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt <<END
|
||||||
${@buildhistory_get_imagevars(d)}
|
${@buildhistory_get_imagevars(d)}
|
||||||
END
|
END
|
||||||
|
|
|
@ -20,7 +20,7 @@ python do_menuconfig() {
|
||||||
except OSError:
|
except OSError:
|
||||||
mtime = 0
|
mtime = 0
|
||||||
|
|
||||||
oe_terminal("${SHELL} -c \"make menuconfig; if [ $? -ne 0 ]; then echo 'Command failed.'; echo -n 'Press any key to continue... '; read r; fi\"", '${PN} Configuration', d)
|
oe_terminal("${SHELL} -c \"make menuconfig; if [ $? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"", '${PN} Configuration', d)
|
||||||
|
|
||||||
# FIXME this check can be removed when the minimum bitbake version has been bumped
|
# FIXME this check can be removed when the minimum bitbake version has been bumped
|
||||||
if hasattr(bb.build, 'write_taint'):
|
if hasattr(bb.build, 'write_taint'):
|
||||||
|
|
|
@ -112,16 +112,16 @@ license_create_manifest() {
|
||||||
echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_MANIFEST}
|
echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_MANIFEST}
|
||||||
echo "PACKAGE VERSION:" ${pkged_pv} >> ${LICENSE_MANIFEST}
|
echo "PACKAGE VERSION:" ${pkged_pv} >> ${LICENSE_MANIFEST}
|
||||||
echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_MANIFEST}
|
echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_MANIFEST}
|
||||||
echo -n "LICENSE:" >> ${LICENSE_MANIFEST}
|
printf "LICENSE:" >> ${LICENSE_MANIFEST}
|
||||||
for lic in ${pkged_lic}; do
|
for lic in ${pkged_lic}; do
|
||||||
# to reference a license file trim trailing + symbol
|
# to reference a license file trim trailing + symbol
|
||||||
if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic%+}" ]; then
|
if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic%+}" ]; then
|
||||||
echo -n " ${lic}" >> ${LICENSE_MANIFEST}
|
printf " ${lic}" >> ${LICENSE_MANIFEST}
|
||||||
else
|
else
|
||||||
echo "WARNING: The license listed ${lic} was not in the licenses collected for ${pkged_pn}"
|
echo "WARNING: The license listed ${lic} was not in the licenses collected for ${pkged_pn}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "\n" >> ${LICENSE_MANIFEST}
|
printf "\n\n" >> ${LICENSE_MANIFEST}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Two options here:
|
# Two options here:
|
||||||
|
|
|
@ -192,7 +192,7 @@ deb_log_check() {
|
||||||
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
echo "log_check: There were error messages in the logfile"
|
echo "log_check: There were error messages in the logfile"
|
||||||
echo -e "log_check: Matched keyword: [$keyword_die]\n"
|
printf "log_check: Matched keyword: [$keyword_die]\n\n"
|
||||||
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
||||||
echo ""
|
echo ""
|
||||||
do_exit=1
|
do_exit=1
|
||||||
|
|
|
@ -181,7 +181,7 @@ ipk_log_check() {
|
||||||
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
echo "log_check: There were error messages in the logfile"
|
echo "log_check: There were error messages in the logfile"
|
||||||
echo -e "log_check: Matched keyword: [$keyword_die]\n"
|
printf "log_check: Matched keyword: [$keyword_die]\n\n"
|
||||||
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
||||||
echo ""
|
echo ""
|
||||||
do_exit=1
|
do_exit=1
|
||||||
|
|
|
@ -110,7 +110,7 @@ rpm_log_check() {
|
||||||
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
echo "log_check: There were error messages in the logfile"
|
echo "log_check: There were error messages in the logfile"
|
||||||
echo -e "log_check: Matched keyword: [$keyword_die]\n"
|
printf "log_check: Matched keyword: [$keyword_die]\n\n"
|
||||||
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
||||||
echo ""
|
echo ""
|
||||||
do_exit=1
|
do_exit=1
|
||||||
|
@ -211,8 +211,8 @@ process_pkg_list_rpm() {
|
||||||
pkgs="$@"
|
pkgs="$@"
|
||||||
local confbase=${INSTALL_CONFBASE_RPM}
|
local confbase=${INSTALL_CONFBASE_RPM}
|
||||||
|
|
||||||
echo -n > ${target_rootfs}/install/base_archs.pkglist
|
printf "" > ${target_rootfs}/install/base_archs.pkglist
|
||||||
echo -n > ${target_rootfs}/install/ml_archs.pkglist
|
printf "" > ${target_rootfs}/install/ml_archs.pkglist
|
||||||
|
|
||||||
for pkg in $pkgs; do
|
for pkg in $pkgs; do
|
||||||
echo "Processing $pkg..."
|
echo "Processing $pkg..."
|
||||||
|
|
|
@ -118,7 +118,7 @@ fakeroot create_shar() {
|
||||||
|
|
||||||
DEFAULT_INSTALL_DIR="${SDKPATH}"
|
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
|
read target_sdk_dir
|
||||||
|
|
||||||
if [ "$target_sdk_dir" = "" ]; then
|
if [ "$target_sdk_dir" = "" ]; then
|
||||||
|
@ -128,7 +128,7 @@ fi
|
||||||
eval target_sdk_dir=$target_sdk_dir
|
eval target_sdk_dir=$target_sdk_dir
|
||||||
target_sdk_dir=$(readlink -m $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
|
read answer
|
||||||
|
|
||||||
if [ "$answer" = "" ]; then
|
if [ "$answer" = "" ]; then
|
||||||
|
@ -148,11 +148,11 @@ fi
|
||||||
|
|
||||||
payload_offset=$(($(grep -na -m1 "^MARKER:$" $(basename $0)|cut -d':' -f1) + 1))
|
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
|
tail -n +$payload_offset $(basename $0) | tar xj --strip-components=4 -C $target_sdk_dir
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo -n "Setting it up..."
|
printf "Setting it up..."
|
||||||
# fix environment paths
|
# fix environment paths
|
||||||
env_setup_script=$(find $target_sdk_dir -name "environment-setup-${REAL_MULTIMACH_TARGET_SYS}")
|
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
|
sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script
|
||||||
|
|
|
@ -117,11 +117,11 @@ do_install_basefilesissue () {
|
||||||
|
|
||||||
install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
|
install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
|
||||||
if [ -n "${DISTRO_NAME}" ]; then
|
if [ -n "${DISTRO_NAME}" ]; then
|
||||||
echo -n "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
|
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
|
||||||
echo -n "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
|
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
|
||||||
if [ -n "${DISTRO_VERSION}" ]; then
|
if [ -n "${DISTRO_VERSION}" ]; then
|
||||||
echo -n "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
|
printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
|
||||||
echo -n "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
|
printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
|
||||||
fi
|
fi
|
||||||
echo "\n \l" >> ${D}${sysconfdir}/issue
|
echo "\n \l" >> ${D}${sysconfdir}/issue
|
||||||
echo >> ${D}${sysconfdir}/issue
|
echo >> ${D}${sysconfdir}/issue
|
||||||
|
|
|
@ -106,10 +106,10 @@ do_archgen () {
|
||||||
continue;;
|
continue;;
|
||||||
esac
|
esac
|
||||||
if [ "${AVOID_CONSTRUCTOR}" != "true" ]; then
|
if [ "${AVOID_CONSTRUCTOR}" != "true" ]; then
|
||||||
echo -n " const Arch Arch_${each_arch} " | tr - _ >> zypp/oe-arch.h
|
printf " const Arch Arch_${each_arch} " | tr - _ >> zypp/oe-arch.h
|
||||||
echo "(_${each_arch});" | tr - _ >> zypp/oe-arch.h
|
echo "(_${each_arch});" | tr - _ >> zypp/oe-arch.h
|
||||||
else
|
else
|
||||||
echo -n " const Arch Arch_${each_arch} " | tr - _ >> zypp/oe-arch.h
|
printf " const Arch Arch_${each_arch} " | tr - _ >> zypp/oe-arch.h
|
||||||
echo "( IdString ( \"${each_arch}\" ) );" | tr - _ >> zypp/oe-arch.h
|
echo "( IdString ( \"${each_arch}\" ) );" | tr - _ >> zypp/oe-arch.h
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -31,12 +31,12 @@ do_install(){
|
||||||
mkdir -p ${D}${base_bindir}
|
mkdir -p ${D}${base_bindir}
|
||||||
mkdir -p ${D}/${baselib}
|
mkdir -p ${D}/${baselib}
|
||||||
mkdir -p ${D}${sysconfdir}/lsb-release.d
|
mkdir -p ${D}${sysconfdir}/lsb-release.d
|
||||||
echo -n "LSB_VERSION=\"core-4.1-noarch:" > ${D}${sysconfdir}/lsb-release
|
printf "LSB_VERSION=\"core-4.1-noarch:" > ${D}${sysconfdir}/lsb-release
|
||||||
|
|
||||||
if [ "${TARGET_ARCH}" = "i586" ];then
|
if [ "${TARGET_ARCH}" = "i586" ];then
|
||||||
echo -n "core-4.1-ia32" >> ${D}${sysconfdir}/lsb-release
|
printf "core-4.1-ia32" >> ${D}${sysconfdir}/lsb-release
|
||||||
else
|
else
|
||||||
echo -n "core-4.1-${TARGET_ARCH}" >> ${D}${sysconfdir}/lsb-release
|
printf "core-4.1-${TARGET_ARCH}" >> ${D}${sysconfdir}/lsb-release
|
||||||
fi
|
fi
|
||||||
echo "\"" >> ${D}${sysconfdir}/lsb-release
|
echo "\"" >> ${D}${sysconfdir}/lsb-release
|
||||||
echo "DISTRIB_ID=${DISTRO}" >> ${D}${sysconfdir}/lsb-release
|
echo "DISTRIB_ID=${DISTRO}" >> ${D}${sysconfdir}/lsb-release
|
||||||
|
|
|
@ -75,7 +75,7 @@ fi
|
||||||
image_details $IMAGE
|
image_details $IMAGE
|
||||||
device_details $(basename $DEVICE)
|
device_details $(basename $DEVICE)
|
||||||
|
|
||||||
echo -n "Write $IMAGE to $DEVICE [y/N]? "
|
printf "Write $IMAGE to $DEVICE [y/N]? "
|
||||||
read RESPONSE
|
read RESPONSE
|
||||||
if [ "$RESPONSE" != "y" ]; then
|
if [ "$RESPONSE" != "y" ]; then
|
||||||
echo "Write aborted"
|
echo "Write aborted"
|
||||||
|
|
Loading…
Reference in New Issue