scripts: Change here document delimiters

Fix the outstanding scripts using non standard shell here document delimiters.

This should have been caught by
https://github.com/kata-containers/tests/pull/3937, but there is a bug
in the checker which is fixed on
https://github.com/kata-containers/tests/pull/4569.

Fixes: #3864.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2022-03-10 09:23:37 +00:00
parent 5a7fd943c1
commit 5d6d39be48
18 changed files with 60 additions and 60 deletions

View File

@ -7,14 +7,14 @@
# //
die() {
cat <<EOT >&2
cat <<EOF >&2
====================================================================
==== compile protocols failed ====
$1
====================================================================
EOT
EOF
exit 1
}

View File

@ -72,7 +72,7 @@ readonly mem_boundary_mb=128
source "${lib_file}"
usage() {
cat <<EOT
cat <<EOF
Usage: ${script_name} [options] <rootfs-dir>
This script will create a Kata Containers image file of
an adequate size based on the <rootfs-dir> directory.
@ -117,7 +117,7 @@ Kernels and hypervisors that support DAX/NVDIMM read the MBR #2, otherwise MBR #
[1] - https://github.com/kata-containers/kata-containers/blob/main/tools/osbuilder/image-builder/nsdax.gpl.c
[2] - https://github.com/torvalds/linux/blob/master/drivers/nvdimm/pfn.h
EOT
EOF
}

View File

@ -23,7 +23,7 @@ AGENT_INIT=${AGENT_INIT:-no}
usage()
{
error="${1:-0}"
cat <<EOT
cat <<EOF
Usage: ${script_name} [options] <rootfs-dir>
This script creates a Kata Containers initrd image file based on the
<rootfs-dir> directory.
@ -38,7 +38,7 @@ Extra environment variables:
DEFAULT: kata-agent
AGENT_INIT: use kata agent as init process
DEFAULT: no
EOT
EOF
exit "${error}"
}

View File

@ -63,7 +63,7 @@ typeset init=
usage()
{
error="${1:-0}"
cat <<EOT
cat <<EOF
Usage: ${script_name} [options] [DISTRO]
@ -143,7 +143,7 @@ Refer to the Platform-OS Compatibility Matrix for more details on the supported
architectures:
https://github.com/kata-containers/kata-containers/tree/main/tools/osbuilder#platform-distro-compatibility-matrix
EOT
EOF
exit "${error}"
}
@ -473,7 +473,7 @@ setup_rootfs()
local unitFile="./etc/systemd/system/tmp.mount"
info "Install tmp.mount in ./etc/systemd/system"
mkdir -p `dirname "$unitFile"`
cp ./usr/share/systemd/tmp.mount "$unitFile" || cat > "$unitFile" << EOT
cp ./usr/share/systemd/tmp.mount "$unitFile" || cat > "$unitFile" << EOF
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
@ -496,7 +496,7 @@ What=tmpfs
Where=/tmp
Type=tmpfs
Options=mode=1777,strictatime,nosuid,nodev
EOT
EOF
fi
popd >> /dev/null
@ -519,12 +519,12 @@ EOT
esac
info "Configure chrony file ${chrony_conf_file}"
cat >> "${chrony_conf_file}" <<EOT
cat >> "${chrony_conf_file}" <<EOF
refclock PHC /dev/ptp0 poll 3 dpoll -2 offset 0
# Step the system clock instead of slewing it if the adjustment is larger than
# one second, at any time
makestep 1 -1
EOT
EOF
# Comment out ntp sources for chrony to be extra careful
# Reference: https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html

View File

@ -168,7 +168,7 @@ create_summary_file()
local -r agentdir="${script_dir}/../../../"
local -r agent_version=$(cat ${agentdir}/VERSION)
cat >"$file"<<-EOT
cat >"$file"<<-EOF
---
osbuilder:
url: "${osbuilder_url}"
@ -190,7 +190,7 @@ ${extra}
name: "${AGENT_BIN}"
version: "${agent_version}"
agent-is-init-daemon: "${AGENT_INIT}"
EOT
EOF
local rootfs_file="${file_dir}/$(basename "${file}")"
info "Created summary file '${rootfs_file}' inside rootfs"

View File

@ -53,7 +53,7 @@ source "${project_dir}/scripts/lib.sh"
usage()
{
cat <<EOT
cat <<EOF
Usage: $script_name [options] [command | <distro>]
Options:
@ -72,7 +72,7 @@ Otherwise, tests are run on all distros.
$(basename ${test_config}) includes a list of distros to exclude from testing,
depending on the detected test environment. However, when a <distro> is specified,
distro exclusion based on $(basename ${test_config}) is not enforced.
EOT
EOF
}
# Add an entry to the specified stats file

View File

@ -59,7 +59,7 @@ build_image() {
usage() {
return_code=${1:-0}
cat <<EOT
cat <<EOF
Create image and initrd in a tarball for kata containers.
Use it to build an image to distribute kata.
@ -70,7 +70,7 @@ Options:
--imagetype=${image_type}
--prefix=${prefix}
--destdir=${destdir}
EOT
EOF
exit "${return_code}"
}

View File

@ -50,7 +50,7 @@ error() {
usage() {
return_code=${1:-0}
cat <<EOT
cat <<EOF
This script is used as part of the ${project} release process.
It is used to create a tarball with static binaries.
@ -74,7 +74,7 @@ options:
rootfs-image
rootfs-initrd
shim-v2
EOT
EOF
exit "${return_code}"
}

View File

@ -94,10 +94,10 @@ function configure_different_shims_base() {
fi
fi
cat << EOT | tee "$shim_file"
cat << EOF | tee "$shim_file"
#!/usr/bin/env bash
KATA_CONF_FILE=/opt/kata/share/defaults/kata-containers/configuration-${shim}.toml /opt/kata/bin/containerd-shim-kata-v2 "\$@"
EOT
EOF
chmod +x "$shim_file"
if [ "${shim}" == "${default_shim}" ]; then
@ -132,7 +132,7 @@ function configure_crio_runtime() {
local kata_path="/usr/local/bin/containerd-shim-${runtime}-v2"
local kata_conf="crio.runtime.runtimes.${runtime}"
cat <<EOT | tee -a "$crio_drop_in_conf_file"
cat <<EOF | tee -a "$crio_drop_in_conf_file"
# Path to the Kata Containers runtime binary that uses the $1
[$kata_conf]
@ -140,7 +140,7 @@ function configure_crio_runtime() {
runtime_type = "vm"
runtime_root = "/run/vc"
privileged_without_host_devices = true
EOT
EOF
}
function configure_crio() {
@ -178,22 +178,22 @@ function configure_containerd_runtime() {
echo "Configuration exists for $runtime_table, overwriting"
sed -i "/\[$runtime_table\]/,+1s#runtime_type.*#runtime_type = \"${runtime_type}\"#" $containerd_conf_file
else
cat <<EOT | tee -a "$containerd_conf_file"
cat <<EOF | tee -a "$containerd_conf_file"
[$runtime_table]
runtime_type = "${runtime_type}"
privileged_without_host_devices = true
pod_annotations = ["io.katacontainers.*"]
EOT
EOF
fi
if grep -q "\[$options_table\]" $containerd_conf_file; then
echo "Configuration exists for $options_table, overwriting"
sed -i "/\[$options_table\]/,+1s#ConfigPath.*#ConfigPath = \"${config_path}\"#" $containerd_conf_file
else
cat <<EOT | tee -a "$containerd_conf_file"
cat <<EOF | tee -a "$containerd_conf_file"
[$options_table]
ConfigPath = "${config_path}"
EOT
EOF
fi
}

View File

@ -65,7 +65,7 @@ source "${packaging_scripts_dir}/lib.sh"
usage() {
exit_code="$1"
cat <<EOT
cat <<EOF
Overview:
Build a kernel for Kata Containers
@ -99,7 +99,7 @@ Options:
-t <hypervisor> : Hypervisor_target.
-v <version> : Kernel version to use if kernel path not provided.
-x <type> : Confidential guest protection type, such as sev and tdx
EOT
EOF
exit "$exit_code"
}

View File

@ -28,7 +28,7 @@ die() {
usage() {
return_code=${1:-0}
cat <<EOT
cat <<EOF
Usage:
${script_name} [options] <version>
@ -41,7 +41,7 @@ options:
-h : show this help
-p : push image to github
EOT
EOF
exit "${return_code}"
}

View File

@ -26,7 +26,7 @@ trap exit_handler EXIT
usage() {
return_code=${1:-}
cat <<EOT
cat <<EOF
Usage ${script_name} <previous-release> <new_release>
Args:
@ -37,7 +37,7 @@ new-release: new release version that will have the
Example:
./${script_name} 1.2.0 1.2.1 > notes.md
EOT
EOF
exit "${return_code}"
}
@ -81,25 +81,25 @@ changes() {
}
print_release_notes() {
cat <<EOT
cat <<EOF
# Release ${runtime_version}
EOT
EOF
for repo in "${repos[@]}"; do
git clone -q "https://github.com/${project}/${repo}.git" "${tmp_dir}/${repo}"
pushd "${tmp_dir}/${repo}" >>/dev/null
cat <<EOT
cat <<EOF
## ${repo} Changes
$(changes)
EOT
EOF
popd >>/dev/null
rm -rf "${tmp_dir}/${repo}"
done
cat <<EOT
cat <<EOF
## Compatibility with CRI-O
Kata Containers ${runtime_version} is compatible with CRI-O ${crio_version}
@ -157,7 +157,7 @@ More information [Limitations][limitations]
[custom-agent-doc]: https://github.com/kata-containers/kata-containers/blob/main/docs/Developer-Guide.md#build-a-custom-kata-agent---optional
[limitations]: https://github.com/kata-containers/kata-containers/blob/${new_release}/docs/Limitations.md
[installation]: https://github.com/kata-containers/kata-containers/blob/${new_release}/docs/install
EOT
EOF
}
main() {

View File

@ -27,16 +27,16 @@ source "${script_dir}/../scripts/lib.sh"
function usage() {
cat <<EOT
cat <<EOF
Usage: ${script_name} [options] <args>
This script creates a new release for ${PROJECT}.
It tags and create release for:
EOT
EOF
for r in "${repos[@]}"; do
echo " - ${r}"
done
cat <<EOT
cat <<EOF
Args:
status : Get Current ${PROJECT} tags status
@ -48,7 +48,7 @@ Options:
-h : Show this help
-p : push tags
EOT
EOF
}

View File

@ -223,12 +223,12 @@ bump_repo() {
info "Creating PR message"
notes_file=notes.md
cat <<EOT >"${notes_file}"
cat <<EOF >"${notes_file}"
# Kata Containers ${new_version}
$(get_changes "$current_version")
EOT
EOF
cat "${notes_file}"
if (echo "${current_version}" | grep "alpha") && (echo "${new_version}" | grep -v "alpha");then
@ -282,7 +282,7 @@ EOT
usage() {
exit_code="$1"
cat <<EOT
cat <<EOF
Usage:
${script_name} [options] <args>
Args:
@ -293,7 +293,7 @@ Example:
Options
-h : Show this help
-p : create a PR
EOT
EOF
exit "$exit_code"
}

View File

@ -12,7 +12,7 @@ script_dir="$(realpath $(dirname $0))"
patches_dir="$1"
if [ -z "$patches_dir" ]; then
cat <<-EOT
cat <<-EOF
Apply patches to the sources at the current directory.
Patches are expected to be named in the standard git-format-patch(1) format where
@ -30,7 +30,7 @@ if [ -z "$patches_dir" ]; then
$0 PATCHES_DIR
Where:
PATCHES_DIR is the directory containing the patches
EOT
EOF
exit 1
fi

View File

@ -72,7 +72,7 @@ die() {
# Display usage to stdout.
usage() {
cat <<EOT
cat <<EOF
Overview:
Display configure options required to build the specified
@ -94,7 +94,7 @@ Example:
$ $script_name qemu
EOT
EOF
}
show_tags_header() {
@ -102,10 +102,10 @@ show_tags_header() {
local key
local value
cat <<EOT
cat <<EOF
# Recognised option tags:
#
EOT
EOF
# sort the tags
keys=${!recognised_tags[@]}

View File

@ -55,7 +55,7 @@ gen_version_file() {
# see https://github.com/semver/semver/issues/145
kata_version=$(get_kata_version)
kata_version=${kata_version/-/\~}
cat > "$versions_txt" <<EOT
cat > "$versions_txt" <<EOF
# This is a generated file from ${script_name}
kata_version=${kata_version}
@ -70,7 +70,7 @@ kernel_version=${kernel_version}
# Golang
go_version=${golang_version}
EOT
EOF
}
die() {
@ -85,7 +85,7 @@ die() {
usage() {
exit_code=$"${1:-0}"
cat <<EOT
cat <<EOF
Usage:
${script_name} [--compare | -h | --help] <kata-branch>
@ -98,7 +98,7 @@ Options:
--compare Only compare the kata version at branch <kata-branch> with the
one in ${versions_txt} and leave the file untouched.
--head Use <kata-branch>'s head to generate the versions file.
EOT
EOF
exit "${exit_code}"
}

View File

@ -31,7 +31,7 @@ info() {
usage(){
exit_code="$1"
cat <<EOT
cat <<EOF
Usage:
${script_name} [options]
@ -43,7 +43,7 @@ Options
-d <path> : destination path, path where go will be installed.
-f : enable force install, remove existent go pkg before installation.
-h : display this help.
EOT
EOF
exit "$exit_code"
}