]> git.ozlabs.org Git - next-scripts/commitdiff
make_tree_file: shellcheck fixes
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 30 Nov 2022 04:53:15 +0000 (15:53 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 30 Nov 2022 04:53:15 +0000 (15:53 +1100)
make_tree_file

index 75614f6bb80595c39b1944d1ca14e4f84f2985f0..0d8e42a184aea95a94223652228fc4c19327b3a3 100755 (executable)
@@ -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 ...