mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-16 22:39:01 +00:00
shellcheck: Fix shellcheck SC2068
> Double quote array expansions to avoid re-splitting elements Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
@@ -19,4 +19,4 @@ supported_artifacts=(
|
||||
"install_qemu"
|
||||
)
|
||||
|
||||
for c in ${supported_artifacts[@]}; do echo $c; done
|
||||
for c in "${supported_artifacts[@]}"; do echo $c; done
|
||||
|
@@ -145,7 +145,7 @@ docker run \
|
||||
--env ARCH="${ARCH}" \
|
||||
--rm \
|
||||
-w ${script_dir} \
|
||||
build-kata-deploy "${kata_deploy_create}" $@
|
||||
build-kata-deploy "${kata_deploy_create}" "$@"
|
||||
|
||||
if [ $remove_dot_docker_dir == true ]; then
|
||||
rm -rf "$HOME/.docker"
|
||||
|
@@ -193,7 +193,7 @@ cleanup_and_fail() {
|
||||
if [ -n "${extra_tarballs}" ]; then
|
||||
local mapping
|
||||
IFS=' ' read -a mapping <<< "${extra_tarballs}"
|
||||
for m in ${mapping[@]}; do
|
||||
for m in "${mapping[@]}"; do
|
||||
local extra_tarball_name=${m%:*}
|
||||
rm -f "${extra_tarball_name}"
|
||||
done
|
||||
@@ -273,7 +273,7 @@ install_cached_tarball_component() {
|
||||
|
||||
local mapping
|
||||
IFS=' ' read -a mapping <<< "${extra_tarballs}"
|
||||
for m in ${mapping[@]}; do
|
||||
for m in "${mapping[@]}"; do
|
||||
local extra_tarball_name=${m%:*}
|
||||
local extra_tarball_path=${m#*:}
|
||||
|
||||
@@ -1470,5 +1470,5 @@ main() {
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main $@
|
||||
main "$@"
|
||||
fi
|
||||
|
@@ -169,8 +169,8 @@ function get_container_runtime() {
|
||||
else
|
||||
echo "k3s"
|
||||
fi
|
||||
# Note: we assumed you used a conventional k0s setup and k0s will generate a systemd entry k0scontroller.service and k0sworker.service respectively
|
||||
# and it is impossible to run this script without a kubelet, so this k0s controller must also have worker mode enabled
|
||||
# Note: we assumed you used a conventional k0s setup and k0s will generate a systemd entry k0scontroller.service and k0sworker.service respectively
|
||||
# and it is impossible to run this script without a kubelet, so this k0s controller must also have worker mode enabled
|
||||
elif host_systemctl is-active --quiet k0scontroller; then
|
||||
echo "k0s-controller"
|
||||
elif host_systemctl is-active --quiet k0sworker; then
|
||||
@@ -339,7 +339,7 @@ function adjust_qemu_cmdline() {
|
||||
# Both qemu and qemu-coco-dev use exactly the same QEMU, so we can adjust
|
||||
# the shim on the qemu-coco-dev case to qemu
|
||||
[[ "${shim}" =~ ^(qemu|qemu-coco-dev)$ ]] && qemu_share="qemu"
|
||||
|
||||
|
||||
qemu_binary=$(tomlq '.hypervisor.qemu.path' ${config_path} | tr -d \")
|
||||
qemu_binary_script="${qemu_binary}-installation-prefix"
|
||||
qemu_binary_script_host_path="/host/${qemu_binary_script}"
|
||||
@@ -430,7 +430,7 @@ function install_artifacts() {
|
||||
*)
|
||||
tdx_not_supported ${ID} ${VERSION_ID}
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ "${dest_dir}" != "${default_dest_dir}" ]; then
|
||||
@@ -606,19 +606,19 @@ function configure_containerd_runtime() {
|
||||
local runtime_type=\"io.containerd."${runtime}".v2\"
|
||||
local runtime_config_path=\"$(get_kata_containers_config_path "${shim}")/${configuration}.toml\"
|
||||
local runtime_path=\"$(get_kata_containers_runtime_path "${shim}")\"
|
||||
|
||||
|
||||
tomlq -i -t $(printf '%s.runtime_type=%s' ${runtime_table} ${runtime_type}) ${configuration_file}
|
||||
tomlq -i -t $(printf '%s.runtime_path=%s' ${runtime_table} ${runtime_path}) ${configuration_file}
|
||||
tomlq -i -t $(printf '%s.privileged_without_host_devices=true' ${runtime_table}) ${configuration_file}
|
||||
tomlq -i -t $(printf '%s.pod_annotations=["io.katacontainers.*"]' ${runtime_table}) ${configuration_file}
|
||||
tomlq -i -t $(printf '%s.ConfigPath=%s' ${runtime_options_table} ${runtime_config_path}) ${configuration_file}
|
||||
|
||||
|
||||
if [ "${DEBUG}" == "true" ]; then
|
||||
tomlq -i -t '.debug.level = "debug"' ${configuration_file}
|
||||
fi
|
||||
|
||||
if [ -n "${SNAPSHOTTER_HANDLER_MAPPING}" ]; then
|
||||
for m in ${snapshotters[@]}; do
|
||||
for m in "${snapshotters[@]}"; do
|
||||
key="${m%$snapshotters_delimiter*}"
|
||||
|
||||
if [ "${key}" != "${shim}" ]; then
|
||||
@@ -746,7 +746,7 @@ function snapshotter_handler_mapping_validation_check() {
|
||||
return
|
||||
fi
|
||||
|
||||
for m in ${snapshotters[@]}; do
|
||||
for m in "${snapshotters[@]}"; do
|
||||
shim="${m%$snapshotters_delimiter*}"
|
||||
snapshotter="${m#*$snapshotters_delimiter}"
|
||||
|
||||
@@ -813,7 +813,7 @@ function main() {
|
||||
containerd_conf_tmpl_file="${containerd_conf_file}.tmpl"
|
||||
containerd_conf_file_backup="${containerd_conf_tmpl_file}.bak"
|
||||
elif [[ "$runtime" =~ ^(k0s-worker|k0s-controller)$ ]]; then
|
||||
# From 1.27.1 onwards k0s enables dynamic configuration on containerd CRI runtimes.
|
||||
# From 1.27.1 onwards k0s enables dynamic configuration on containerd CRI runtimes.
|
||||
# This works by k0s creating a special directory in /etc/k0s/containerd.d/ where user can drop-in partial containerd configuration snippets.
|
||||
# k0s will automatically pick up these files and adds these in containerd configuration imports list.
|
||||
containerd_conf_file="/etc/containerd/containerd.d/kata-containers.toml"
|
||||
|
@@ -718,4 +718,4 @@ main() {
|
||||
esac
|
||||
}
|
||||
|
||||
main $@
|
||||
main "$@"
|
||||
|
@@ -143,8 +143,8 @@ function _publish_multiarch_manifest()
|
||||
_check_required_env_var "KATA_DEPLOY_IMAGE_TAGS"
|
||||
_check_required_env_var "KATA_DEPLOY_REGISTRIES"
|
||||
|
||||
for registry in ${REGISTRIES[@]}; do
|
||||
for tag in ${IMAGE_TAGS[@]}; do
|
||||
for registry in "${REGISTRIES[@]}"; do
|
||||
for tag in "${IMAGE_TAGS[@]}"; do
|
||||
docker manifest create ${registry}:${tag} \
|
||||
--amend ${registry}:${tag}-amd64 \
|
||||
--amend ${registry}:${tag}-arm64 \
|
||||
|
@@ -38,7 +38,7 @@ echo "INFO: Apply patches from $patches_dir"
|
||||
if [ -d "$patches_dir" ]; then
|
||||
patches=($(find "$patches_dir" -maxdepth 1 -name '*.patch'|sort -t- -k1,1n))
|
||||
echo "INFO: Found ${#patches[@]} patches"
|
||||
for patch in ${patches[@]}; do
|
||||
for patch in "${patches[@]}"; do
|
||||
echo "INFO: Apply $patch"
|
||||
patch -p1 < "$patch" || \
|
||||
{ echo >&2 "ERROR: Not applied. Exiting..."; exit 1; }
|
||||
|
@@ -595,4 +595,4 @@ main() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
main $@
|
||||
main "$@"
|
||||
|
@@ -185,4 +185,4 @@ main() {
|
||||
gen_version_file "${branch}" "${kata_version}"
|
||||
}
|
||||
|
||||
main $@
|
||||
main "$@"
|
||||
|
@@ -38,4 +38,4 @@ build_coco_guest_components_from_source() {
|
||||
popd
|
||||
}
|
||||
|
||||
build_coco_guest_components_from_source $@
|
||||
build_coco_guest_components_from_source "$@"
|
||||
|
@@ -19,7 +19,7 @@ fi
|
||||
pushd "${QEMU_DESTDIR}"
|
||||
# Remove files to reduce the surface.
|
||||
echo "INFO: remove uneeded files"
|
||||
for pattern in ${qemu_black_list[@]}; do
|
||||
for pattern in "${qemu_black_list[@]}"; do
|
||||
find . -path "$pattern" | xargs rm -rfv
|
||||
done
|
||||
|
||||
|
@@ -83,4 +83,4 @@ main() {
|
||||
info "kata-webhook is up and working"
|
||||
}
|
||||
|
||||
main $@
|
||||
main "$@"
|
||||
|
Reference in New Issue
Block a user