Skip to content

Commit 3d5a33a

Browse files
authored
Refactor install_dependencies to use bash array (#17)
* 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. * chore: sort package list alphabetically in install_dependencies
1 parent 8c5d52d commit 3d5a33a

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 bison busybox-static cpio curl flex gcc libelf-dev libssl-dev make patch squashfs-tools tree
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)