(#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 <noreply@anthropic.com>
This commit is contained in:
Igor Velkov 2026-03-02 04:58:53 +02:00 committed by Igor
parent 4654894352
commit f0201782a4

View File

@ -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