Skip to content

Commit

Permalink
Update "Packages" scraping to use "awk" instead of "grep|grep|cut"
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Nov 28, 2016
1 parent 874a700 commit 92c8ff1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ versions=( "${versions[@]%/}" )
travisEnv=
for version in "${versions[@]}"; do
suite="${suites[$version]:-$defaultSuite}"
fullVersion="$(curl -sSL "http://ftp.osuosl.org/pub/mariadb/repo/$version/debian/dists/$suite/main/binary-amd64/Packages" |tac|tac| grep -m1 -A10 "^Package: mariadb-server\$" | grep -m1 '^Version: ' | cut -d' ' -f2)"
fullVersion="$(
curl -fsSL "http://ftp.osuosl.org/pub/mariadb/repo/$version/debian/dists/$suite/main/binary-amd64/Packages" \
| tac|tac \
| awk -F ': ' '$1 == "Package" { pkg = $2; next } $1 == "Version" && pkg == "mariadb-server" { print $2; exit }'
)"
if [ -z "$fullVersion" ]; then
echo >&2 "warning: cannot find $version in $suite"
continue
Expand Down

0 comments on commit 92c8ff1

Please sign in to comment.