Skip to content

Commit 5dc3cbb

Browse files
committed
Fix "update.sh" handling of whitespace on SHA256 scraping
See view-source:https://www.ruby-lang.org//en/news/2019/04/01/ruby-2-4-6-released/ ("SHA256:" has whitespace before it)
1 parent 6f3497e commit 5dc3cbb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

update.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ for version in "${versions[@]}"; do
4545
for tryVersion in "${allVersions[@]}"; do
4646
if \
4747
{
48-
versionReleasePage="$(echo "$releasesPage" | grep "<td>Ruby $tryVersion</td>" -A 2 | awk -F '"' '$1 == "<td><a href=" { print $2; exit }')" \
48+
versionReleasePage="$(grep "<td>Ruby $tryVersion</td>" -A 2 <<<"$releasesPage" | awk -F '"' '$1 == "<td><a href=" { print $2; exit }')" \
4949
&& [ "$versionReleasePage" ] \
50-
&& shaVal="$(curl -fsSL "https://www.ruby-lang.org/$versionReleasePage" |tac|tac| grep "ruby-$tryVersion.tar.xz" -A 5 | awk '/^SHA256:/ { print $2; exit }')" \
50+
&& shaVal="$(curl -fsSL "https://www.ruby-lang.org/$versionReleasePage" |tac|tac| grep "ruby-$tryVersion.tar.xz" -A 5 | awk '$1 == "SHA256:" { print $2; exit }')" \
5151
&& [ "$shaVal" ]
5252
} \
5353
|| {
5454
versionReleasePage="$(echo "$newsPage" | grep -oE '<a href="[^"]+">Ruby '"$tryVersion"' Released</a>' | cut -d'"' -f2)" \
5555
&& [ "$versionReleasePage" ] \
56-
&& shaVal="$(curl -fsSL "https://www.ruby-lang.org/$versionReleasePage" |tac|tac| grep "ruby-$tryVersion.tar.xz" -A 5 | awk '/^SHA256:/ { print $2; exit }')" \
56+
&& shaVal="$(curl -fsSL "https://www.ruby-lang.org/$versionReleasePage" |tac|tac| grep "ruby-$tryVersion.tar.xz" -A 5 | awk '$1 == "SHA256:" { print $2; exit }')" \
5757
&& [ "$shaVal" ]
5858
} \
5959
; then

0 commit comments

Comments
 (0)