########################################################
# Workaround for 'sdb shell' inability to propagate error codes
-function sdb_shell {
+function sdb_shell_verbose {
set +e
error_str='SDB_ERROR'
exit 1
fi
+ if [[ -n ${output} ]]; then
+ # strip last '\r' character
+ printf "%s" "${output::(-1)}"
+ fi
+
set -e
}
+# Silent version
+function sdb_shell {
+ sdb_shell_verbose ${@} >/dev/null
+}
+
########################################################
# GLOBAL VARIABLES
########################################################
echo "Checking architecture..."
declare -A archs=([x86_64]='x86_64' [i686]='i586')
-ARCH=${archs["$(sdb_shell_print uname -m)"]}
+ARCH=${archs["$(sdb_shell_verbose uname -m)"]}
if [[ -z ${ARCH} || ! -d ${TARGET_DIR}/${ARCH} ]]; then
echo "Error: there is no built ${target_name} for ${ARCH} architecture."
exit 1