raspberrypi-eeprom/tr-instead-of-string-in-rpi-eeprom-update.patch
yafen 15e711cc11 update source version to 2022.01.25-138a1
(cherry picked from commit 11c375590ad89befe88f6f22abfbc6d0ac9d6549)
2022-07-22 17:02:11 +08:00

23 lines
1.1 KiB
Diff

diff --git a/rpi-eeprom-update b/rpi-eeprom-update
index 7b92a5e..78a5739 100755
--- a/rpi-eeprom-update
+++ b/rpi-eeprom-update
@@ -114,7 +114,7 @@ getBootloaderConfig() {
local blconfig_nvmem_path=""
if [ -f "${blconfig_alias}" ]; then
- local blconfig_ofnode_path="/sys/firmware/devicetree/base"$(strings "${blconfig_alias}")""
+ local blconfig_ofnode_path="/sys/firmware/devicetree/base"$(tr -cd [:print:] < "${blconfig_alias}")""
local blconfig_ofnode_link=$(find -L /sys/bus/nvmem -samefile "${blconfig_ofnode_path}" 2>/dev/null)
if [ -e "${blconfig_ofnode_link}" ]; then
@@ -279,7 +279,7 @@ getBootloaderUpdateVersion() {
match=".*/pieeprom-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].bin"
latest="$(find "${FIRMWARE_IMAGE_DIR}/" -maxdepth 1 -type f -size "${EEPROM_SIZE}c" -regex "${match}" | sort -r | head -n1)"
if [ -f "${latest}" ]; then
- BOOTLOADER_UPDATE_VERSION=$(strings "${latest}" | grep BUILD_TIMESTAMP | sed 's/.*=//g')
+ BOOTLOADER_UPDATE_VERSION=$(tr -c [:print:] "\n" < "${latest}" | sed '/^BUILD_TIMESTAMP=/s/.*=//p;d')
BOOTLOADER_UPDATE_IMAGE="${latest}"
fi
}