From f0201782a4cb4715f088389c11d1c6f032877b88 Mon Sep 17 00:00:00 2001 From: Igor Velkov <325961+iav@users.noreply.github.com> Date: Mon, 2 Mar 2026 04:58:53 +0200 Subject: [PATCH] (#9400 P1a) lib/functions/image/partitioning.sh: convert [ ] to [[ ]] Replace POSIX `[ ]` with bash `[[ ]]` on three remaining single-bracket conditionals: two numeric comparisons on sfdisk version (lines 251, 270) and one -z test with unquoted variable (line 485, also adds quoting). Co-Authored-By: Claude Sonnet 4.6 --- lib/functions/image/partitioning.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/functions/image/partitioning.sh b/lib/functions/image/partitioning.sh index 6262fe197a..dfe2974169 100644 --- a/lib/functions/image/partitioning.sh +++ b/lib/functions/image/partitioning.sh @@ -248,7 +248,7 @@ function prepare_partitions() { # Check sfdisk version to determine if --sector-size is supported sfdisk_version=$(sfdisk --version | awk '/util-linux/ {print $NF}') sfdisk_version_num=$(echo "$sfdisk_version" | awk -F. '{printf "%d%02d%02d\n", $1, $2, $3}') - if [ "$sfdisk_version_num" -ge "24100" ]; then + if [[ "$sfdisk_version_num" -ge "24100" ]]; then echo "${partition_script_output}" | run_host_command_logged sfdisk --sector-size "$SECTOR_SIZE" "${SDCARD}".raw || exit_with_error "Partitioning failed!" else echo "${partition_script_output}" | run_host_command_logged sfdisk "${SDCARD}".raw || exit_with_error "Partitioning failed!" @@ -267,7 +267,7 @@ function prepare_partitions() { declare -g LOOP #--partscan is using to force the kernel for scaning partition table in preventing of partprobe errors - if [ "$sfdisk_version_num" -ge "24100" ]; then + if [[ "$sfdisk_version_num" -ge "24100" ]]; then LOOP=$(losetup --show --partscan --find -b "$SECTOR_SIZE" "${SDCARD}".raw) || exit_with_error "Unable to find free loop device" else LOOP=$(losetup --show --partscan --find "${SDCARD}".raw) || exit_with_error "Unable to find free loop device" @@ -482,7 +482,7 @@ function prepare_partitions() { # recompile .cmd to .scr if boot.cmd exists if [[ -f "${SDCARD}/boot/boot.cmd" ]]; then - if [ -z ${BOOTSCRIPT_OUTPUT} ]; then + if [[ -z "${BOOTSCRIPT_OUTPUT}" ]]; then BOOTSCRIPT_OUTPUT=boot.scr fi case ${LINUXFAMILY} in