mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 03:21:28 +01:00
more shellcheck
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
43fab0cce2
commit
5eccef3c66
|
@ -138,6 +138,7 @@ install_kernel(){
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2068
|
||||||
install_kernel $@
|
install_kernel $@
|
||||||
|
|
||||||
echo "Kernel successfully installed!"
|
echo "Kernel successfully installed!"
|
||||||
|
|
|
@ -17,4 +17,5 @@ iptables -t nat -A POSTROUTING -s 172.20.0.1/16 -j MASQUERADE
|
||||||
# start the virtlogd daemon
|
# start the virtlogd daemon
|
||||||
exec virtlogd --daemon &
|
exec virtlogd --daemon &
|
||||||
|
|
||||||
|
# shellcheck disable=SC2068
|
||||||
exec $@
|
exec $@
|
||||||
|
|
|
@ -16,14 +16,17 @@ AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
|
||||||
get_latest() {
|
get_latest() {
|
||||||
local repo=$1
|
local repo=$1
|
||||||
|
|
||||||
local resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/releases")
|
local resp
|
||||||
local tag=$(echo $resp | jq -e --raw-output .[0].tag_name)
|
resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/releases")
|
||||||
local name=$(echo $resp | jq -e --raw-output .[0].name)
|
local tag
|
||||||
|
tag=$(echo "$resp" | jq -e --raw-output .[0].tag_name)
|
||||||
|
local name
|
||||||
|
name=$(echo "$resp" | jq -e --raw-output .[0].name)
|
||||||
|
|
||||||
if [[ "$tag" == "null" ]]; then
|
if [[ "$tag" == "null" ]]; then
|
||||||
# get the latest tag
|
# get the latest tag
|
||||||
local resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/tags")
|
resp=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${repo}/tags")
|
||||||
local tag=$(echo $resp | jq -e --raw-output .[0].name)
|
tag=$(echo "$resp" | jq -e --raw-output .[0].name)
|
||||||
tag=${tag#release-}
|
tag=${tag#release-}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -52,7 +55,8 @@ get_latest() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change to upper case for grep
|
# Change to upper case for grep
|
||||||
local udir=$(echo $dir | awk '{print toupper($0)}')
|
local udir
|
||||||
|
udir=$(echo $dir | awk '{print toupper($0)}')
|
||||||
# Replace dashes (-) with underscores (_)
|
# Replace dashes (-) with underscores (_)
|
||||||
udir=${udir//-/_}
|
udir=${udir//-/_}
|
||||||
udir=${udir%/*}
|
udir=${udir%/*}
|
||||||
|
@ -60,9 +64,9 @@ get_latest() {
|
||||||
local current
|
local current
|
||||||
if [[ ! -d "$dir" ]]; then
|
if [[ ! -d "$dir" ]]; then
|
||||||
# If the directory does not exist, then grep all for it
|
# If the directory does not exist, then grep all for it
|
||||||
current=$(grep -m 1 "${udir}_VERSION" **/Dockerfile | head -n 1 | awk '{print $(NF)}')
|
current=$(grep -m 1 "${udir}_VERSION" -- **/Dockerfile | head -n 1 | awk '{print $(NF)}')
|
||||||
else
|
else
|
||||||
current=$(cat "${dir}/Dockerfile" | grep -m 1 "${udir}_VERSION" | awk '{print $(NF)}')
|
current=$(grep -m 1 "${udir}_VERSION" "${dir}/Dockerfile" | awk '{print $(NF)}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,14 +89,14 @@ compare() {
|
||||||
local name="$1" dir="$2" tag="$3" current="$4" releases="$5"
|
local name="$1" dir="$2" tag="$3" current="$4" releases="$5"
|
||||||
ignore_dirs=( "bazel" "bcc" "mc" "nzbget" "osquery" "powershell" "rstudio" )
|
ignore_dirs=( "bazel" "bcc" "mc" "nzbget" "osquery" "powershell" "rstudio" )
|
||||||
|
|
||||||
if [[ "$tag" =~ "$current" ]] || [[ "$name" =~ "$current" ]] || [[ "$current" =~ "$tag" ]] || [[ "$current" == "master" ]]; then
|
if [[ "$tag" =~ $current ]] || [[ "$name" =~ $current ]] || [[ "$current" =~ $tag ]] || [[ "$current" == "master" ]]; then
|
||||||
echo -e "\e[36m${dir}:\e[39m current ${current} | ${tag} | ${name}"
|
echo -e "\\e[36m${dir}:\\e[39m current ${current} | ${tag} | ${name}"
|
||||||
else
|
else
|
||||||
# add to the bad versions
|
# add to the bad versions
|
||||||
if [[ ! " ${ignore_dirs[@]} " =~ " ${dir} " ]]; then
|
if [[ ! " ${ignore_dirs[*]} " =~ ${dir} ]]; then
|
||||||
bad_versions+=( "${dir}" )
|
bad_versions+=( "${dir}" )
|
||||||
fi
|
fi
|
||||||
echo -e "\e[31m${dir}:\e[39m current ${current} | ${tag} | ${name} | ${releases}"
|
echo -e "\\e[31m${dir}:\\e[39m current ${current} | ${tag} | ${name} | ${releases}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,16 +156,18 @@ unifi
|
||||||
bad_versions=()
|
bad_versions=()
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
# shellcheck disable=SC2068
|
||||||
for p in ${projects[@]}; do
|
for p in ${projects[@]}; do
|
||||||
get_latest "$p"
|
get_latest "$p"
|
||||||
done
|
done
|
||||||
|
# shellcheck disable=SC2068
|
||||||
for p in ${other_projects[@]}; do
|
for p in ${other_projects[@]}; do
|
||||||
get_latest_"$p"
|
get_latest_"$p"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${#bad_versions[@]} -ne 0 ]]; then
|
if [[ ${#bad_versions[@]} -ne 0 ]]; then
|
||||||
echo
|
echo
|
||||||
echo "These Dockerfiles are not up to date: ${bad_versions[@]}" >&2
|
echo "These Dockerfiles are not up to date: ${bad_versions[*]}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -e
|
||||||
|
|
||||||
MITMPROXY_PATH="/home/mitmproxy/.mitmproxy"
|
MITMPROXY_PATH="/home/mitmproxy/.mitmproxy"
|
||||||
|
|
||||||
if [[ "$1" = "mitmdump" || "$1" = "mitmproxy" || "$1" = "mitmweb" ]]; then
|
if [ "$1" = "mitmdump" ] || [ "$1" = "mitmproxy" ] || [ "$1" = "mitmweb" ]; then
|
||||||
mkdir -p "$MITMPROXY_PATH"
|
mkdir -p "$MITMPROXY_PATH"
|
||||||
chown -R mitmproxy:mitmproxy "$MITMPROXY_PATH"
|
chown -R mitmproxy:mitmproxy "$MITMPROXY_PATH"
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ if [ -d "$HOME/.gnupg" ]; then
|
||||||
if [ -f "/usr/share/doc/mutt/examples/gpg.rc" ]; then
|
if [ -f "/usr/share/doc/mutt/examples/gpg.rc" ]; then
|
||||||
echo 'source /usr/share/doc/mutt/examples/gpg.rc'
|
echo 'source /usr/share/doc/mutt/examples/gpg.rc'
|
||||||
fi
|
fi
|
||||||
if [[ ! -z "$GPG_ID" ]]; then
|
if [ ! -z "$GPG_ID" ]; then
|
||||||
echo "set pgp_sign_as = $GPG_ID"
|
echo "set pgp_sign_as = $GPG_ID"
|
||||||
fi
|
fi
|
||||||
echo 'set crypt_replysign=yes'
|
echo 'set crypt_replysign=yes'
|
||||||
|
|
|
@ -11,6 +11,7 @@ inet_protocols = ipv4
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Do we want to modify the config first with the script?
|
# Do we want to modify the config first with the script?
|
||||||
|
# shellcheck disable=SC1091
|
||||||
[ -f /etc/service/postfix/run.config ] && source /etc/service/postfix/run.config
|
[ -f /etc/service/postfix/run.config ] && source /etc/service/postfix/run.config
|
||||||
|
|
||||||
if [[ ! -z "$MAILNAME" ]]; then
|
if [[ ! -z "$MAILNAME" ]]; then
|
||||||
|
@ -79,5 +80,5 @@ if [[ ! -z "$SASL_AUTH" ]]; then
|
||||||
chmod 600 /etc/postfix/sasl_passwd.db
|
chmod 600 /etc/postfix/sasl_passwd.db
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /usr/lib/postfix/master -c /etc/postfix -d 2>&1
|
/usr/lib/postfix/master -c /etc/postfix -d 2>&1
|
||||||
tail -F /var/log/mail.log
|
tail -F /var/log/mail.log
|
||||||
|
|
2
run.sh
2
run.sh
|
@ -27,7 +27,7 @@ for name in "$@"; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
script=$(sed -n '/docker run/,/^#$/p' "$name/Dockerfile" | head -n -1 | sed "s/#//" | sed "s#\\\##" | tr '\n' ' ' | sed "s/\$@//" | sed 's/""//')
|
script=$(sed -n '/docker run/,/^#$/p' "$name/Dockerfile" | head -n -1 | sed "s/#//" | sed "s#\\\\##" | tr '\n' ' ' | sed "s/\$@//" | sed 's/""//')
|
||||||
echo "Running: $script"
|
echo "Running: $script"
|
||||||
|
|
||||||
if [ $TEST ]; then
|
if [ $TEST ]; then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user