Skip to content

Commit

Permalink
Merge pull request docker-library#11 from infosiftr/update-script
Browse files Browse the repository at this point in the history
Add simple update.sh script
  • Loading branch information
yosifkit committed Aug 14, 2014
2 parents 3fb8a22 + 4aa2080 commit bdb892a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -e

cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"

versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )

for version in "${versions[@]}"; do
fullVersion="$(curl -sSL "https://dev.mysql.com/downloads/mysql/$version.html?os=2" \
| grep '">(mysql-'"$version"'.*-linux-glibc2\.5-x86_64\.tar\.gz)<' \
| sed -r 's!.*\(mysql-([^<)]+)-linux-glibc2\.5-x86_64\.tar\.gz\).*!\1!' \
| sort -V | tail -1)"

(
set -x
sed -ri '
s/^(ENV MYSQL_MAJOR) .*/\1 '"$version"'/;
s/^(ENV MYSQL_VERSION) .*/\1 '"$fullVersion"'/
' "$version/Dockerfile"
)
done

0 comments on commit bdb892a

Please sign in to comment.