Skip to content

Commit 8a7e8c6

Browse files
committed
refactor: use bash array for packages in install_dependencies
Use an array instead of a plain string to avoid word-splitting issues and move apt update before apt install for clarity.
1 parent 7fa4f34 commit 8a7e8c6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ TARGET_ARCH="${TARGET_ARCH:-x86_64}"
88
HOST_ARCH="$(uname -m)"
99

1010
function install_dependencies {
11-
apt update
12-
local packages="bc flex bison gcc make libelf-dev libssl-dev squashfs-tools busybox-static tree cpio curl patch"
11+
local packages=(
12+
bc flex bison gcc make libelf-dev libssl-dev squashfs-tools busybox-static tree cpio curl patch
13+
)
1314

14-
if [[ "$TARGET_ARCH" == "arm64" && "$HOST_ARCH" != "aarch64" ]]; then
15-
packages="$packages gcc-aarch64-linux-gnu"
16-
fi
15+
[[ "${TARGET_ARCH}" == "arm64" && "${HOST_ARCH}" != "aarch64" ]] && packages+=( gcc-aarch64-linux-gnu )
1716

18-
apt install -y $packages
17+
apt update
18+
apt install -y "${packages[@]}"
1919
}
2020

2121
# prints the git tag corresponding to the newest and best matching the provided kernel version $1

0 commit comments

Comments
 (0)