bcm4908: fix calculation of new cferam index

The arithmetic expansion fails when idx becomes a two digit number.
Fix this by relying on expr command.

root@OpenWrt:/# echo $(((028 + 0) % 1000))
/bin/ash: arithmetic syntax error
root@OpenWrt:/# echo $(($(expr 028 + 0) % 1000))
28

Fixes: a6a0b252ba ("bcm4908: add sysupgrade support")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
This commit is contained in:
Sungbo Eo 2021-08-01 22:17:04 +09:00 committed by Rafał Miłecki
parent a05452e4d6
commit f432353850
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
RAMFS_COPY_BIN="bcm4908img"
RAMFS_COPY_BIN="bcm4908img expr"
PART_NAME=firmware
@ -129,7 +129,7 @@ platform_calc_new_cferam() {
umount $dir
rm -fr $dir
idx=$(((idx + inc) % 1000))
idx=$(($(expr $idx + $inc) % 1000))
echo $(printf "cferam.%03d" $idx)
}