Fix rpi-eeprom-update when using busybox find

The busybox implementation of find does not detect recursive nested
symlinks, this results in it finding multiple instances of of_node
matching -samefile, the result of which then fails the -e path test.

The of_node symlink we're tyring to find should match the path
/sys/bus/nvmem/devices/*/of_node so just limit the find depth to 3 as
there's no point searching deeper than that.

Signed-off-by: Allan Xavier <mr.a.xavier@googlemail.com>
This commit is contained in:
Allan Xavier
2023-01-12 12:08:55 +00:00
parent b4b4605c7d
commit 55ca589ab9

View File

@@ -126,7 +126,7 @@ getBootloaderConfig() {
if [ -f "${blconfig_alias}" ]; then
local blconfig_ofnode_path="/sys/firmware/devicetree/base"$(strings "${blconfig_alias}")""
local blconfig_ofnode_link=$(find -L /sys/bus/nvmem -samefile "${blconfig_ofnode_path}" 2>/dev/null)
local blconfig_ofnode_link=$(find -L /sys/bus/nvmem -maxdepth 3 -samefile "${blconfig_ofnode_path}" 2>/dev/null)
if [ -e "${blconfig_ofnode_link}" ]; then
blconfig_nvmem_path=$(dirname "${blconfig_ofnode_link}")