From: Stephen Rothwell Date: Wed, 30 Nov 2022 04:53:15 +0000 (+1100) Subject: make_tree_file: shellcheck fixes X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=3f1901a951c11d0e9f95355f999f1857c4edc6e3;p=next-scripts make_tree_file: shellcheck fixes --- diff --git a/make_tree_file b/make_tree_file index 75614f6..0d8e42a 100755 --- a/make_tree_file +++ b/make_tree_file @@ -1,6 +1,7 @@ #!/bin/bash -. "$(dirname $0)/common.sh" +# shellcheck source=./common.sh +. "$(dirname "$0")/common.sh" # Don't do releases in the wee hours :-) h=$(date '+%k') @@ -10,7 +11,8 @@ h=$(date '+%k') } read -r -p "Yubikey token: " tok -ssh git@gitolite.kernel.org 2fa val-session $tok +# shellcheck disable=SC2029 +ssh git@gitolite.kernel.org 2fa val-session "$tok" # This means I get the right tag if I finish after midnight d=$(date --date "5 hours ago" '+%Y%m%d') @@ -28,21 +30,23 @@ mkdir Next EOF IFS=' ' - grep -v '^#' $CTRL_FILE | - while read email type name url ref build; do - [ "$type" = "branch" ] && continue - tab="\t" - [ ${#name} -lt 8 ] && tab="\t\t" - [ "$type" = "git" ] && url="$url#${ref##*:}" - printf "%s$tab%s\t%s\n" $name $type $url - done + while read -r email type name url ref _; do + case "$email" in + \#*) continue;; + esac + [ "$type" = "branch" ] && continue + tab="\t" + [ ${#name} -lt 8 ] && tab="\t\t" + [ "$type" = "git" ] && url="$url#${ref##*:}" + printf "%s$tab%s\t%s\n" "$name" "$type" "$url" + done <"$CTRL_FILE" ) >Next/Trees mv ../SHA1s Next/SHA1s grep -v '^Checking out files:' ../merge.log >Next/merge.log -printf -- "-next-%s\n" $d >localversion-next +printf -- "-next-%s\n" "$d" >localversion-next git add Next localversion-next git commit -s -v -a -m "Add linux-next specific files for $d" @@ -58,8 +62,9 @@ oldest=$(date --date "3 months ago" '+%Y%m%d') echo "Removing old releases ... <= next-$oldest" old_tags=$(git tag -l 'next-*[0-9]' | - awk -F - '$2 ~ /^[0-9]*$/ && $2 <= '$oldest' { printf("next-%s\n", $2); }') + awk -F - -v oldest="$oldest" '$2 ~ /^[0-9]*$/ && $2 <= oldest { printf("next-%s\n", $2); }') +# shellcheck disable=SC2086 [ "$old_tags" ] && git tag -d $old_tags echo Pushing to korg ...