[LEDE-DEV] [patch master 04/15] $/${} is unnecessary on arithmetic variables
Jan-Tarek Butt
tarek at ring0.de
Fri Sep 30 13:02:18 PDT 2016
---
scripts/om-fwupgradecfg-gen.sh | 10 +++++-----
scripts/ubinize-image.sh | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh
index 93f6794..5cbb8d1 100644
--- a/scripts/om-fwupgradecfg-gen.sh
+++ b/scripts/om-fwupgradecfg-gen.sh
@@ -43,16 +43,16 @@ CHECK_BS=65536
KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH")
KERNEL_MD5=$(md5=$(md5sum "$KERNEL_PATH"); echo "${md5%% *}")
KERNEL_SHA256=$(openssl dgst -sha256 "$KERNEL_PATH" | awk '{print $2}')
-KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt "$KERNEL_SIZE" ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024)))
+KERNEL_PART_SIZE=$(size=$((KERNEL_SIZE / FLASH_BS)); [ $((size * FLASH_BS)) -lt "$KERNEL_SIZE" ] && size=$((size + 1)); echo $((size * FLASH_BS / 1024)))
-ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr)
+ROOTFS_FLASH_ADDR=$(addr=$((KERNEL_FLASH_ADDR + (KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr)
ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH")
-ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS))
+ROOTFS_CHECK_BLOCKS=$(((ROOTFS_SIZE / CHECK_BS) - MD5_SKIP_BLOCKS))
ROOTFS_MD5=$(md5=$(dd if="$ROOTFS_PATH" bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo "${md5%% *}")
ROOTFS_MD5_FULL=$(md5=$(md5sum "$ROOTFS_PATH"); echo "${md5%% *}")
ROOTFS_SHA256_FULL=$(openssl dgst -sha256 "$ROOTFS_PATH" | awk '{print $2}')
-ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS)))
-ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE))
+ROOTFS_CHECK_SIZE=$(printf '0x%x' $((ROOTFS_CHECK_BLOCKS * CHECK_BS)))
+ROOTFS_PART_SIZE=$((MAX_PART_SIZE - KERNEL_PART_SIZE))
cat << EOF > "$CFG_OUT"
[vmlinux]
diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh
index 1117e5b..d947bdd 100755
--- a/scripts/ubinize-image.sh
+++ b/scripts/ubinize-image.sh
@@ -45,9 +45,9 @@ ubilayout() {
local root_is_ubifs="$( is_ubifs "$2" )"
if [ "$1" = "ubootenv" ]; then
ubivol $vol_id ubootenv
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
ubivol $vol_id ubootenv2
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
fi
for part in $parts; do
name="${part%%=*}"
@@ -63,14 +63,14 @@ ubilayout() {
size="$part"
ubivol $vol_id "$name" "$image" "" "$size"
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
done
if [ "$3" ]; then
ubivol $vol_id kernel "$3"
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
fi
ubivol $vol_id rootfs "$2" "$root_is_ubifs"
- vol_id=$(( $vol_id + 1 ))
+ vol_id=$(( vol_id + 1 ))
[ "$root_is_ubifs" ] || ubivol $vol_id rootfs_data "" 1
}
--
2.10.0
More information about the Lede-dev
mailing list