meta-digi: fix scripts to remove undesired warning ignoring null bytes

Bash v4.4 or higher warns when discarding NULL bytes in command substitution
output. Remove these bytes to avoid the undesired warnings.

https://jira.digi.com/browse/DEL-5588

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
Arturo Buzarra 2018-01-24 14:07:58 +01:00
parent bc3bf7b336
commit 314d4c82d6
6 changed files with 22 additions and 22 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2017, Digi International Inc. # Copyright (c) 2017,2018 Digi International Inc.
# #
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
@ -48,8 +48,8 @@ if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then
fi fi
rm -f "${TMP_MACFILE}" rm -f "${TMP_MACFILE}"
OTP_REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" OTP_REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null | tr -d '\0')"
DTB_REGION_CODE="$(cat /proc/device-tree/wireless/regulatory-domain 2>/dev/null)" DTB_REGION_CODE="$(cat /proc/device-tree/wireless/regulatory-domain 2>/dev/null | tr -d '\0')"
US_CODE="0x0" US_CODE="0x0"
WW_CODE="0x1" WW_CODE="0x1"
JP_CODE="0x2" JP_CODE="0x2"

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2012-2017 by Digi International Inc. # Copyright (C) 2012-2018 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -56,7 +56,7 @@ bluetooth_init() {
# Symlink the correct firmware file depending on region code # Symlink the correct firmware file depending on region code
JPN_REGCODE="0x2" JPN_REGCODE="0x2"
REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null | tr -d '\0')"
BT_CLASS_LINK="PS_ASIC.pst" BT_CLASS_LINK="PS_ASIC.pst"
BT_CLASS_FILE="PS_ASIC_class_1.pst" BT_CLASS_FILE="PS_ASIC_class_1.pst"
if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2012-2017 by Digi International Inc. # Copyright (C) 2012-2018 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -47,7 +47,7 @@ bluetooth_init() {
fi fi
# Module version older than revision 4 has swapped TX and RX lines # Module version older than revision 4 has swapped TX and RX lines
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))" MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null | tr -d '\0' || true)))"
if [ "${MOD_VERSION}" -lt "4" ]; then if [ "${MOD_VERSION}" -lt "4" ]; then
# Ignore the CTS flow control # Ignore the CTS flow control
BT_CTS_QCA_GPIO_NR="18" BT_CTS_QCA_GPIO_NR="18"

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2012-2017 by Digi International Inc. # Copyright (C) 2012-2018 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -56,7 +56,7 @@ bluetooth_init() {
# Symlink the correct firmware file depending on region code # Symlink the correct firmware file depending on region code
JPN_REGCODE="0x2" JPN_REGCODE="0x2"
REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null | tr -d '\0')"
BT_CLASS_LINK="PS_ASIC.pst" BT_CLASS_LINK="PS_ASIC.pst"
BT_CLASS_FILE="PS_ASIC_class_1.pst" BT_CLASS_FILE="PS_ASIC_class_1.pst"
if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2012-2017 by Digi International Inc. # Copyright (C) 2012-2018 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -47,7 +47,7 @@ bluetooth_init() {
fi fi
# Module version older than revision 4 has swapped TX and RX lines # Module version older than revision 4 has swapped TX and RX lines
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))" MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null | tr -d '\0' || true)))"
if [ "${MOD_VERSION}" -lt "4" ]; then if [ "${MOD_VERSION}" -lt "4" ]; then
# Ignore the CTS flow control # Ignore the CTS flow control
BT_CTS_QCA_GPIO_NR="18" BT_CTS_QCA_GPIO_NR="18"

View File

@ -3,7 +3,7 @@
# #
# sysinfo # sysinfo
# #
# Copyright (C) 2016,2017 by Digi International Inc. # Copyright (C) 2016-2018 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -254,28 +254,28 @@ make_report(){
DISTRO="$(sed -ne 's,DISTRO = \(.*\)$,\1,g;T;p' /etc/build)" DISTRO="$(sed -ne 's,DISTRO = \(.*\)$,\1,g;T;p' /etc/build)"
DEY_VERSION="$(sed -ne 's,DISTRO_VERSION = \(.*\)$,\1,g;T;p' /etc/build)" DEY_VERSION="$(sed -ne 's,DISTRO_VERSION = \(.*\)$,\1,g;T;p' /etc/build)"
UBOOT_VERSION="$(cat /proc/device-tree/digi,uboot,version 2>/dev/null)" UBOOT_VERSION="$(cat /proc/device-tree/digi,uboot,version 2>/dev/null | tr -d '\0')"
if [ -z "${UBOOT_VERSION}" ]; then if [ -z "${UBOOT_VERSION}" ]; then
UBOOT_PARTITION="/dev/mmcblk0boot0" UBOOT_PARTITION="/dev/mmcblk0boot0"
[ -c "/dev/mtd0" ] && UBOOT_PARTITION="/dev/mtd0" [ -c "/dev/mtd0" ] && UBOOT_PARTITION="/dev/mtd0"
UBOOT_VERSION="$(strings ${UBOOT_PARTITION} | grep -m 1 dub | cut -d' ' -f2)" UBOOT_VERSION="$(strings ${UBOOT_PARTITION} | grep -m 1 dub | cut -d' ' -f2)"
fi fi
MACHINE="$(cat /proc/device-tree/digi,machine,name)" MACHINE="$(cat /proc/device-tree/digi,machine,name | tr -d '\0')"
BOARD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant)" BOARD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant | tr -d '\0')"
BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn)" BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn | tr -d '\0')"
BOARD_VERSION="$(cat /proc/device-tree/digi,carrierboard,version)" BOARD_VERSION="$(cat /proc/device-tree/digi,carrierboard,version | tr -d '\0')"
BOARD_ID="$(cat /proc/device-tree/digi,carrierboard,id)" BOARD_ID="$(cat /proc/device-tree/digi,carrierboard,id | tr -d '\0')"
if grep -qs '\<digi,ccimx6ul\>' /proc/device-tree/compatible; then if grep -qs '\<digi,ccimx6ul\>' /proc/device-tree/compatible; then
MCA_NODE="/sys/bus/i2c/devices/0-007e" MCA_NODE="/sys/bus/i2c/devices/0-007e"
MCA_HW_VERSION=$(cat ${MCA_NODE}/hw_version) || MCA_HW_VERSION="??" MCA_HW_VERSION=$(cat ${MCA_NODE}/hw_version 2>/dev/null | tr -d '\0') || MCA_HW_VERSION="??"
MCA_FW_VERSION=$(cat ${MCA_NODE}/fw_version) || MCA_FW_VERSION="??" MCA_FW_VERSION=$(cat ${MCA_NODE}/fw_version 2>/dev/null | tr -d '\0') || MCA_FW_VERSION="??"
MCA_VERSION="HW_VERSION=${MCA_HW_VERSION} FW_VERSION=${MCA_FW_VERSION}" MCA_VERSION="HW_VERSION=${MCA_HW_VERSION} FW_VERSION=${MCA_FW_VERSION}"
fi fi
IOEXP_NODE="/sys/bus/i2c/devices/0-006e" IOEXP_NODE="/sys/bus/i2c/devices/0-006e"
if [ -d "$IOEXP_NODE" ]; then if [ -d "$IOEXP_NODE" ]; then
IOEXP_HW_VERSION=$(cat ${IOEXP_NODE}/hw_version 2>/dev/null) || IOEXP_HW_VERSION="??" IOEXP_HW_VERSION=$(cat ${IOEXP_NODE}/hw_version 2>/dev/null | tr -d '\0') || IOEXP_HW_VERSION="??"
IOEXP_FW_VERSION=$(cat ${IOEXP_NODE}/fw_version 2>/dev/null) || IOEXP_FW_VERSION="??" IOEXP_FW_VERSION=$(cat ${IOEXP_NODE}/fw_version 2>/dev/null | tr -d '\0') || IOEXP_FW_VERSION="??"
IOEXP_VERSION="HW_VERSION=${IOEXP_HW_VERSION} FW_VERSION=${IOEXP_FW_VERSION}" IOEXP_VERSION="HW_VERSION=${IOEXP_HW_VERSION} FW_VERSION=${IOEXP_FW_VERSION}"
fi fi