scripts: add missing quotes, and minor linting issues

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2021-07-20 12:06:02 +02:00
parent 0cb656860f
commit dba0ef4eb5
14 changed files with 58 additions and 53 deletions

View File

@@ -45,4 +45,4 @@ case "${SELINUX}" in
;;
esac
echo SELinux is $(getenforce)
echo SELinux is "$(getenforce)"

View File

@@ -28,7 +28,7 @@ CNI_CONFIG_DIR=${DESTDIR}/etc/cni/net.d
TMPROOT=$(mktemp -d)
git clone https://github.com/containernetworking/plugins.git "${TMPROOT}"/plugins
pushd "${TMPROOT}"/plugins
git checkout $CNI_COMMIT
git checkout "$CNI_COMMIT"
./build_linux.sh
mkdir -p $CNI_DIR
cp -r ./bin $CNI_DIR

View File

@@ -37,7 +37,7 @@ split_ip() {
local -r varname="$1"
local -r ip="$2"
for i in {0..3}; do
eval "$varname"[$i]=$( echo "$ip" | cut -d '.' -f $((i + 1)) )
eval "$varname"[$i]="$( echo "$ip" | cut -d '.' -f $((i + 1)) )"
done
}

View File

@@ -26,16 +26,17 @@ cd "$GOPATH"
go get -u github.com/onsi/ginkgo/ginkgo
: "${CRITEST_COMMIT:=$(cat "${script_dir}/critools-version")}"
: "${DESTDIR:=""}"
TMPROOT=$(mktemp -d)
git clone https://github.com/kubernetes-sigs/cri-tools.git "${TMPROOT}"/cri-tools
git clone https://github.com/kubernetes-sigs/cri-tools.git "${TMPROOT}/cri-tools"
pushd "${TMPROOT}"/cri-tools
git checkout "$CRITEST_COMMIT"
make
make install -e DESTDIR=${DESTDIR:=''} BINDIR=/usr/local/bin
make install -e DESTDIR="${DESTDIR}" BINDIR=/usr/local/bin
mkdir -p ${DESTDIR:=''}/etc/
cat << EOF | tee ${DESTDIR:=''}/etc/crictl.yaml
mkdir -p "${DESTDIR}/etc/"
cat << EOF | tee "${DESTDIR}/etc/crictl.yaml"
runtime-endpoint: unix:///run/containerd/containerd.sock
EOF

View File

@@ -28,27 +28,27 @@ PROTOBUF_DIR=$(mktemp -d)
case $GOARCH in
arm64)
wget -O $PROTOBUF_DIR/protobuf "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-aarch64.zip"
unzip $PROTOBUF_DIR/protobuf -d /usr/local
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-aarch64.zip"
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
;;
amd64|386)
if [ "$GOOS" = windows ]; then
wget -O $PROTOBUF_DIR/protobuf "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-win32.zip"
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-win32.zip"
elif [ "$GOOS" = linux ]; then
wget -O $PROTOBUF_DIR/protobuf "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip"
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip"
fi
unzip $PROTOBUF_DIR/protobuf -d /usr/local
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
;;
ppc64le)
wget -O $PROTOBUF_DIR/protobuf "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-ppcle_64.zip"
unzip $PROTOBUF_DIR/protobuf -d /usr/local
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-ppcle_64.zip"
unzip "$PROTOBUF_DIR/protobuf" -d /usr/local
;;
*)
wget -O $PROTOBUF_DIR/protobuf "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-cpp-$PROTOBUF_VERSION.zip"
unzip $PROTOBUF_DIR/protobuf -d /usr/src/protobuf
cd /usr/src/protobuf/protobuf-$PROTOBUF_VERSION
wget -O "$PROTOBUF_DIR/protobuf" "https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-cpp-$PROTOBUF_VERSION.zip"
unzip "$PROTOBUF_DIR/protobuf" -d /usr/src/protobuf
cd "/usr/src/protobuf/protobuf-$PROTOBUF_VERSION"
./autogen.sh
./configure --disable-shared
make
@@ -57,4 +57,4 @@ ppc64le)
ldconfig
;;
esac
rm -rf $PROTOBUF_DIR
rm -rf "$PROTOBUF_DIR"

View File

@@ -23,7 +23,8 @@ set -eu -o pipefail
set -x
export SECCOMP_VERSION=2.5.1
export SECCOMP_PATH=$(mktemp -d)
SECCOMP_PATH=$(mktemp -d)
export SECCOMP_PATH
curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" | tar -xzC "$SECCOMP_PATH" --strip-components=1
(
cd "$SECCOMP_PATH"

View File

@@ -17,8 +17,8 @@
set -o nounset
set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
cd ${ROOT}
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
cd "${ROOT}"
# FOCUS focuses the test to run.
FOCUS=${FOCUS:-""}
@@ -29,15 +29,15 @@ RUNTIME=${RUNTIME:-""}
CRI_ROOT="${CONTAINERD_ROOT}/io.containerd.grpc.v1.cri"
mkdir -p ${REPORT_DIR}
test_setup ${REPORT_DIR}
mkdir -p "${REPORT_DIR}"
test_setup "${REPORT_DIR}"
# Run integration test.
${sudo} bin/cri-integration.test --test.run="${FOCUS}" --test.v \
--cri-endpoint=${CONTAINERD_SOCK} \
--cri-root=${CRI_ROOT} \
--runtime-handler=${RUNTIME} \
--containerd-bin=${CONTAINERD_BIN} \
--cri-endpoint="${CONTAINERD_SOCK}" \
--cri-root="${CRI_ROOT}" \
--runtime-handler="${RUNTIME}" \
--containerd-bin="${CONTAINERD_BIN}" \
--image-list="${TEST_IMAGE_LIST:-}"
test_exit_code=$?

View File

@@ -83,7 +83,7 @@ pid=
# NOTE: We don't have the sudo command on Windows.
sudo=""
if [ $(id -u) -ne 0 ] && command -v sudo &> /dev/null; then
if [ "$(id -u)" -ne 0 ] && command -v sudo &> /dev/null; then
sudo="sudo PATH=${PATH}"
fi
@@ -99,7 +99,7 @@ test_setup() {
# Create containerd in a different process group
# so that we can easily clean them up.
keepalive "${sudo} bin/containerd ${CONTAINERD_FLAGS}" \
${RESTART_WAIT_PERIOD} &> ${report_dir}/containerd.log &
"${RESTART_WAIT_PERIOD}" &> "${report_dir}/containerd.log" &
pid=$!
set +m
@@ -122,7 +122,7 @@ test_teardown() {
# so we can kill both of them by matching the PGID.
${sudo} ps | awk "{if (\$3 == ${pid}) print \$1}" | xargs kill
else
${sudo} pkill -g $(ps -o pgid= -p ${pid})
${sudo} pkill -g $(ps -o pgid= -p "${pid}")
fi
fi
}
@@ -131,11 +131,11 @@ test_teardown() {
# keepalive process is eventually killed in test_teardown.
keepalive() {
local command=$1
echo ${command}
echo "${command}"
local wait_period=$2
while true; do
${command}
sleep ${wait_period}
sleep "${wait_period}"
done
}