Skip to content

Commit

Permalink
cli: Fix DEFAULT_OVERLAYS array
Browse files Browse the repository at this point in the history
Shellcheck errors/warnings were:
In lib/functions/rootfs/distro-agnostic.sh line 155:
	display_alert "Adding to extlinux.conf" "fdtoverlays=${DEFAULT_OVERLAYS[@]}" "debug"
                                                         ^--------------------^ SC2145 (error): Argument mixes string and array. Use * or separate argument.

In lib/functions/rootfs/distro-agnostic.sh line 156:
	echo "  fdtoverlays ${DEFAULT_OVERLAYS[@]}" >> "$SDCARD/boot/extlinux/extlinux.conf"
                        ^--------------------^ SC2145 (error): Argument mixes string and array. Use * or separate argument.

In lib/functions/rootfs/distro-agnostic.sh line 193:
	if [[ -n $DEFAULT_OVERLAYS && -f "${SDCARD}"/boot/armbianEnv.txt ]]; then
             ^---------------^ SC2128 (warning): Expanding an array without an index only gives the first element.
  • Loading branch information
ColorfulRhino authored and efectn committed Jun 16, 2024
1 parent 5ea4a2c commit 8cca584
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/functions/rootfs/distro-agnostic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,14 @@ function install_distribution_agnostic() {
fi

if [[ -n $DEFAULT_OVERLAYS ]]; then
DEFAULT_OVERLAYS=(${DEFAULT_OVERLAYS//,/ })
DEFAULT_OVERLAYS=("${DEFAULT_OVERLAYS[@]/%/".dtbo"}")
DEFAULT_OVERLAYS=("${DEFAULT_OVERLAYS[@]/#/"${bootpart_prefix}dtb/${BOOT_FDT_FILE%%/*}/overlay/${OVERLAY_PREFIX}-"}")
DEFAULT_OVERLAYS_ARR=(${DEFAULT_OVERLAYS//,/ })
DEFAULT_OVERLAYS_ARR=("${DEFAULT_OVERLAYS_ARR[@]/%/".dtbo"}")
DEFAULT_OVERLAYS_ARR=("${DEFAULT_OVERLAYS_ARR[@]/#/"${bootpart_prefix}dtb/${BOOT_FDT_FILE%%/*}/overlay/${OVERLAY_PREFIX}-"}")

display_alert "Adding to extlinux.conf" "fdtoverlays=${DEFAULT_OVERLAYS[@]}" "debug"
echo " fdtoverlays ${DEFAULT_OVERLAYS[@]}" >> "$SDCARD/boot/extlinux/extlinux.conf"
display_alert "Adding to extlinux.conf" "fdtoverlays=${DEFAULT_OVERLAYS_ARR[*]}" "debug"
echo " fdtoverlays ${DEFAULT_OVERLAYS_ARR[*]}" >> "$SDCARD/boot/extlinux/extlinux.conf"
fi

else # ... not extlinux ...

if [[ -n "${BOOTSCRIPT}" ]]; then # @TODO: && "${BOOTCONFIG}" != "none"
Expand Down

0 comments on commit 8cca584

Please sign in to comment.