From aa2ebce26d9019190696fd645a8547e6e04afabb Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 19 Apr 2016 13:43:48 -0700 Subject: update.sh: use printf instead of echo printf allows to print escape sequences (e.g. for colored output) and is part of the POSIX standard. Signed-off-by: Stefan Agner Acked-by: Marcel Ziswiler --- recipes/images/files/colibri-imx7/update.sh | 17 +++++++---------- recipes/images/files/colibri-vf/update.sh | 17 +++++++---------- recipes/images/files/library/imx6/update.sh | 12 +++++------- recipes/images/files/library/tegra/update.sh | 20 +++++++++----------- 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/recipes/images/files/colibri-imx7/update.sh b/recipes/images/files/colibri-imx7/update.sh index 68567f2..e7ce607 100755 --- a/recipes/images/files/colibri-imx7/update.sh +++ b/recipes/images/files/colibri-imx7/update.sh @@ -4,9 +4,6 @@ set -e -# sometimes we need the binary echo, not the shell builtin -ECHO=`which echo` - Flash() { echo "To flash the Colibri iMX7 module a running U-Boot is required. Boot the" @@ -131,9 +128,9 @@ fi DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'` if [ "${DEV_OWNER}x" != "rootx" ] then - $ECHO -e "rootfs/dev is not owned by root, but it should!" - $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m" - $ECHO -e "e.g. sudo tar xjvf Colibri_iMX7_LinuxImageV2.6_20160101.tar.bz2" + printf "rootfs/dev is not owned by root, but it should!\n" + printf "\033[1mPlease unpack the tarball with root rights.\033[0m\n" + printf "e.g. sudo tar xjvf Colibri_iMX7_LinuxImageV2.6_20160331.tar.bz2\n" exit 1 fi @@ -143,8 +140,8 @@ if [ "$CNT" -eq 0 ] ; then echo "The program mkfs.ubifs can not be executed or does not provide --space-fixup" echo "option." echo "Are you on a 64bit Linux host without installed 32bit execution environment?" - $ECHO -e "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m" - $ECHO -e "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m" + printf "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m" + printf "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m" exit 1 fi @@ -160,8 +157,8 @@ sudo touch ${BINARIES}/versions.txt sudo chmod ugo+w ${BINARIES}/versions.txt echo "Component Versions" > ${BINARIES}/versions.txt basename "`readlink -e ${BINARIES}/u-boot.imx`" >> ${BINARIES}/versions.txt -$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt -grep MX7 rootfs/etc/issue >> ${BINARIES}/versions.txt +ROOTFSVERSION=`grep MX7 rootfs/etc/issue` +echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt #create subdirectory for this module type sudo mkdir -p "$OUT_DIR" diff --git a/recipes/images/files/colibri-vf/update.sh b/recipes/images/files/colibri-vf/update.sh index b986479..f3881b4 100755 --- a/recipes/images/files/colibri-vf/update.sh +++ b/recipes/images/files/colibri-vf/update.sh @@ -4,9 +4,6 @@ set -e -# sometimes we need the binary echo, not the shell builtin -ECHO=`which echo` - Flash() { echo "To flash the Colibri VF50/VF61 module a running U-Boot is required. Boot the" @@ -148,9 +145,9 @@ fi DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'` if [ "${DEV_OWNER}x" != "rootx" ] then - $ECHO -e "rootfs/dev is not owned by root, but it should!" - $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m" - $ECHO -e "e.g. sudo tar xjvf Colibri_VF_LinuxImageV2.3_20140804.tar.bz2" + printf "rootfs/dev is not owned by root, but it should!\n" + printf "\033[1mPlease unpack the tarball with root rights.\033[0m\n" + printf "e.g. sudo tar xjvf Colibri_VF_LinuxImageV2.6_20160331.tar.bz2\n" exit 1 fi @@ -160,8 +157,8 @@ if [ "$CNT" -eq 0 ] ; then echo "The program mkfs.ubifs can not be executed or does not provide --space-fixup" echo "option." echo "Are you on a 64bit Linux host without installed 32bit execution environment?" - $ECHO -e "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m" - $ECHO -e "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m" + printf "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m\n" + printf "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m\n" exit 1 fi @@ -177,8 +174,8 @@ sudo touch ${BINARIES}/versions.txt sudo chmod ugo+w ${BINARIES}/versions.txt echo "Component Versions" > ${BINARIES}/versions.txt basename "`readlink -e ${BINARIES}/u-boot.imx`" >> ${BINARIES}/versions.txt -$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt -grep VF rootfs/etc/issue >> ${BINARIES}/versions.txt +ROOTFSVERSION=`grep VF rootfs/etc/issue` +echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt #create subdirectory for this module type sudo mkdir -p "$OUT_DIR" diff --git a/recipes/images/files/library/imx6/update.sh b/recipes/images/files/library/imx6/update.sh index be89e17..e5735f9 100755 --- a/recipes/images/files/library/imx6/update.sh +++ b/recipes/images/files/library/imx6/update.sh @@ -6,8 +6,6 @@ # exit on error set -e -# sometimes we need the binary echo, not the shell builtin -ECHO=`which echo` #some distros have fs tools only in root's path PARTED=`which parted` 2> /dev/null || true if [ -e "$PARTED" ] ; then @@ -156,9 +154,9 @@ AWKTEST=`echo 100000000 | awk -v min=100 -v f=10000 '{rootfs_size=$1+f*512;rootf DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'` if [ "${DEV_OWNER}x" != "rootx" ] then - $ECHO -e "rootfs/dev is not owned by root, but it should!" - $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m" - $ECHO -e "e.g. sudo tar xjvf Apalis_iMX6_LinuxImageV2.1_20140201.tar.bz2" + printf "rootfs/dev is not owned by root, but it should!\n" + printf "\033[1mPlease unpack the tarball with root rights.\033[0m\n" + printf "e.g. sudo tar xjvf Apalis_iMX6_LinuxImageV2.6_20160331.tar.bz2\n" exit 1 fi @@ -186,8 +184,8 @@ echo "Component Versions" > ${BINARIES}/versions.txt basename "`readlink -e ${BINARIES}/${U_BOOT_BINARY}`" >> ${BINARIES}/versions.txt basename "`readlink -e ${BINARIES}/${U_BOOT_BINARY_IT}`" >> ${BINARIES}/versions.txt basename "`readlink -e ${BINARIES}/uImage`" >> ${BINARIES}/versions.txt -$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt -grep -i imx6 rootfs/etc/issue >> ${BINARIES}/versions.txt +ROOTFSVERSION=`grep -i imx6 rootfs/etc/issue` +echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt #create subdirectory for this module type sudo mkdir -p "$OUT_DIR" diff --git a/recipes/images/files/library/tegra/update.sh b/recipes/images/files/library/tegra/update.sh index a23f415..ea122ea 100755 --- a/recipes/images/files/library/tegra/update.sh +++ b/recipes/images/files/library/tegra/update.sh @@ -5,8 +5,6 @@ # exit on error set -e -# sometimes we need the binary echo, not the shell builtin -ECHO=`which echo` #some distros have fs tools only in root's path PARTED=`which parted` 2> /dev/null || true if [ -e "$PARTED" ] ; then @@ -209,12 +207,12 @@ if [ "$UBOOT_RECOVERY" -eq 1 ] ; then echo "" echo "256, 512" | grep -q ${RAM_SIZE} if [ $? -eq 1 ] ; then - $ECHO -e "\033[1mplease specify your RAM size with the -r parameter\033[0m" + printf "\033[1mplease specify your RAM size with the -r parameter\033[0m\n" fi echo "v11, v12" | grep -q ${MODVERSION} if [ $? -eq 1 ] ; then - $ECHO -e "\033[1mplease specify your module version with the -v parameter\033[0m" + printf "\033[1mplease specify your module version with the -v parameter\033[0m\n" Usage exit 0 fi @@ -239,9 +237,9 @@ AWKTEST=`echo 100000000 | awk -v min=100 -v f=10000 '{rootfs_size=$1+f*512;rootf DEV_OWNER=`ls -ld rootfs/dev | awk '{print $3}'` if [ "${DEV_OWNER}x" != "rootx" ] then - $ECHO -e "rootfs/dev is not owned by root, but it should!" - $ECHO -e "\033[1mPlease unpack the tarball with root rights.\033[0m" - $ECHO -e "e.g. sudo tar xjvf Apalis_T30_LinuxImageV2.3Beta5_20141219.tar.bz2" + printf "rootfs/dev is not owned by root, but it should!\n" + printf "\033[1mPlease unpack the tarball with root rights.\033[0m\n" + printf "e.g. sudo tar xjvf Apalis_T30_LinuxImageV2.6Beta1_20160331.tar.bz2\n" exit 1 fi @@ -267,8 +265,8 @@ if [ "${MODTYPE}" = "colibri-t20" ] ; then echo "The program mkfs.ubifs can not be executed or does not provide --space-fixup" echo "option." echo "Are you on a 64-bit Linux host without installed 32-bit execution environment?" - $ECHO -e "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m" - $ECHO -e "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m" + printf "\033[1mPlease install e.g. ia32-libs on 64-bit Ubuntu\033[0m\n" + printf "\033[1mMaybe others are needed e.g. liblzo2:i386 on 64-bit Ubuntu\033[0m\n" exit 1 fi fi @@ -286,8 +284,8 @@ if [ "${MODTYPE}" = "colibri-t20" ] ; then else basename "`readlink -e ${BINARIES}/${KERNEL_IMAGETYPE}`" >> ${BINARIES}/versions.txt fi -$ECHO -n "Rootfs " >> ${BINARIES}/versions.txt -grep -i t[2-3]0 rootfs/etc/issue >> ${BINARIES}/versions.txt +ROOTFSVERSION=`grep -i t[2-3]0 rootfs/etc/issue` +echo "Rootfs ${ROOTFSVERSION}" >> ${BINARIES}/versions.txt #create subdirectory for this module type sudo mkdir -p "$OUT_DIR" -- cgit v1.2.3