diff --git a/functions.sh b/functions.sh index be9c575396..4d96d7b813 100755 --- a/functions.sh +++ b/functions.sh @@ -21,25 +21,25 @@ fatal() { function get_arch() { local arch case $(uname -m) in - x86_64) - arch="amd64" - ;; - ppc64le) - arch="ppc64le" - ;; - s390x) - arch="s390x" - ;; - aarch64) - arch="arm64" - ;; - armv7l) - arch="arm32v7" - ;; - *) - echo "$0 does not support architecture ${arch} ... aborting" - exit 1 - ;; + x86_64) + arch="amd64" + ;; + ppc64le) + arch="ppc64le" + ;; + s390x) + arch="s390x" + ;; + aarch64) + arch="arm64" + ;; + armv7l) + arch="arm32v7" + ;; + *) + echo "$0 does not support architecture ${arch} ... aborting" + exit 1 + ;; esac echo "${arch}" @@ -62,7 +62,7 @@ function get_variants() { arch=$(get_arch) variantsfilter=("$@") - IFS=' ' read -ra availablevariants <<< "$(grep "^${arch}" "${dir}/architectures" | sed -E 's/'"${arch}"'[[:space:]]*//' | sed -E 's/,/ /g')" + IFS=' ' read -ra availablevariants <<<"$(grep "^${arch}" "${dir}/architectures" | sed -E 's/'"${arch}"'[[:space:]]*//' | sed -E 's/,/ /g')" if [ ${#variantsfilter[@]} -gt 0 ]; then for variant1 in "${availablevariants[@]}"; do @@ -100,16 +100,16 @@ function get_supported_arches() { shift # Get default supported arches - lines=$(grep "${variant}" "$(dirname "${version}")"/architectures 2> /dev/null | cut -d' ' -f1) + lines=$(grep "${variant}" "$(dirname "${version}")"/architectures 2>/dev/null | cut -d' ' -f1) # Get version specific supported architectures if there is specialized information if [ -a "${version}"/architectures ]; then - lines=$(grep "${variant}" "${version}"/architectures 2> /dev/null | cut -d' ' -f1) + lines=$(grep "${variant}" "${version}"/architectures 2>/dev/null | cut -d' ' -f1) fi while IFS='' read -r line; do arches+=("${line}") - done <<< "${lines}" + done <<<"${lines}" echo "${arches[@]}" } @@ -140,7 +140,7 @@ function get_versions() { local default_variant default_variant=$(get_config "./" "default_variant") - IFS=' ' read -ra dirs <<< "$(echo "./"*/)" + IFS=' ' read -ra dirs <<<"$(echo "./"*/)" for dir in "${dirs[@]}"; do if [ -a "${dir}/Dockerfile" ] || [ -a "${dir}/${default_variant}/Dockerfile" ]; then @@ -168,7 +168,7 @@ function is_debian() { variant=$1 shift - IFS=' ' read -ra debianVersions <<< "$(get_config "./" "debian_versions")" + IFS=' ' read -ra debianVersions <<<"$(get_config "./" "debian_versions")" for d in "${debianVersions[@]}"; do if [ "${d}" = "${variant}" ]; then return 0 @@ -182,7 +182,7 @@ function is_debian_slim() { variant=$1 shift - IFS=' ' read -ra debianVersions <<< "$(get_config "./" "debian_versions")" + IFS=' ' read -ra debianVersions <<<"$(get_config "./" "debian_versions")" for d in "${debianVersions[@]}"; do if [ "${d}-slim" = "${variant}" ]; then return 0 @@ -196,7 +196,7 @@ function get_fork_name() { version=$1 shift - IFS='/' read -ra versionparts <<< "${version}" + IFS='/' read -ra versionparts <<<"${version}" if [ ${#versionparts[@]} -gt 1 ]; then echo "${versionparts[0]}" fi @@ -282,7 +282,7 @@ function get_tag() { fi local tagparts - IFS=' ' read -ra tagparts <<< "$(get_fork_name "${version}") ${tagversion}" + IFS=' ' read -ra tagparts <<<"$(get_fork_name "${version}") ${tagversion}" IFS='-' echo "${tagparts[*]}" unset IFS @@ -300,11 +300,11 @@ function sort_versions() { while IFS='' read -r line; do sorted+=("${line}") - done <<< "$(echo "${lines}" | grep "^[0-9]" | sort -r)" + done <<<"$(echo "${lines}" | grep "^[0-9]" | sort -r)" while IFS='' read -r line; do sorted+=("${line}") - done <<< "$(echo "${lines}" | grep -v "^[0-9]" | sort -r)" + done <<<"$(echo "${lines}" | grep -v "^[0-9]" | sort -r)" echo "${sorted[@]}" } @@ -334,7 +334,7 @@ function images_updated() { commit_range="$(commit_range "$@")" - IFS=' ' read -ra versions <<< "$( + IFS=' ' read -ra versions <<<"$( IFS=',' get_versions )" diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index d0f9d7b701..10c395c614 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -3,7 +3,7 @@ set -e . functions.sh -hash git 2> /dev/null || { echo >&2 "git not found, exiting."; } +hash git 2>/dev/null || { echo >&2 "git not found, exiting."; } # Used dynamically: print "$array_" $1 # shellcheck disable=SC2034 @@ -23,8 +23,8 @@ cd "$(cd "${0%/*}" && pwd -P)" self="$(basename "${BASH_SOURCE[0]}")" -IFS=' ' read -ra versions <<< "$(get_versions)" -IFS=' ' read -ra versions <<< "$(sort_versions "${versions[@]}")" +IFS=' ' read -ra versions <<<"$(get_versions)" +IFS=' ' read -ra versions <<<"$(sort_versions "${versions[@]}")" url='https://github.com/nodejs/docker-node' # get the most recent commit which modified any of "$@" @@ -50,7 +50,7 @@ join() { get_stub() { local version="${1}" shift - IFS='/' read -ra versionparts <<< "${version}" + IFS='/' read -ra versionparts <<<"${version}" local stub eval stub="$(join '_' "${versionparts[@]}" | awk -F. '{ print "$array_" $1 }')" echo "${stub}" @@ -65,11 +65,11 @@ for version in "${versions[@]}"; do fullVersion="$(get_tag "${version}" full)" majorMinorVersion="$(get_tag "${version}" majorminor)" - IFS=' ' read -ra versionAliases <<< "$fullVersion $majorMinorVersion $stub" + IFS=' ' read -ra versionAliases <<<"$fullVersion $majorMinorVersion $stub" if [ -f "${version}/Dockerfile" ]; then # Get supported architectures for a specific version. See details in function.sh - IFS=' ' read -ra supportedArches <<< "$(get_supported_arches "${version}" "default")" + IFS=' ' read -ra supportedArches <<<"$(get_supported_arches "${version}" "default")" echo "Tags: $(join ', ' "${versionAliases[@]}")" echo "Architectures: $(join ', ' "${supportedArches[@]}")" @@ -80,7 +80,7 @@ for version in "${versions[@]}"; do # Get supported variants according to the target architecture. # See details in function.sh - IFS=' ' read -ra variants <<< "$(get_variants "$(dirname "${version}")")" + IFS=' ' read -ra variants <<<"$(get_variants "$(dirname "${version}")")" for variant in "${variants[@]}"; do # Skip non-docker directories [ -f "${version}/${variant}/Dockerfile" ] || continue @@ -100,7 +100,7 @@ for version in "${versions[@]}"; do # Get supported architectures for a specific version and variant. # See details in function.sh - IFS=' ' read -ra supportedArches <<< "$(get_supported_arches "${version}" "${variant}")" + IFS=' ' read -ra supportedArches <<<"$(get_supported_arches "${version}" "${variant}")" echo "Tags: $(join ', ' "${variantAliases[@]}")" echo "Architectures: $(join ', ' "${supportedArches[@]}")" diff --git a/update-keys.sh b/update-keys.sh index 31b8b63f54..e94dc238dc 100755 --- a/update-keys.sh +++ b/update-keys.sh @@ -1,3 +1,3 @@ #!/bin/sh -ex -curl -fsSLo- --compressed https://github.com/nodejs/node/raw/master/README.md | awk '/^gpg --keyserver pool.sks-keyservers.net --recv-keys/ {print $NF}' > keys/node.keys +curl -fsSLo- --compressed https://github.com/nodejs/node/raw/master/README.md | awk '/^gpg --keyserver pool.sks-keyservers.net --recv-keys/ {print $NF}' >keys/node.keys diff --git a/update.sh b/update.sh index 507af21a75..ffe8387062 100755 --- a/update.sh +++ b/update.sh @@ -3,7 +3,7 @@ set -ue function usage() { - cat << EOF + cat < /dev/null; then + if diff -q "${dockerfile}-tmp" "${dockerfile}" >/dev/null; then echo "${dockerfile} is already up to date!" else echo "${dockerfile} updated!" @@ -201,7 +201,7 @@ for version in "${versions[@]}"; do # Get supported variants according the target architecture # See details in function.sh - IFS=' ' read -ra variants <<< "$(get_variants "${parentpath}")" + IFS=' ' read -ra variants <<<"$(get_variants "${parentpath}")" if [ -f "${version}/Dockerfile" ]; then if [ "${update_version}" -eq 0 ]; then