add warning if upgrading via script to migrate

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
Jessica Frazelle 2016-01-14 16:22:06 -08:00
parent 7cd6210a88
commit 60d44d8b80
No known key found for this signature in database
GPG key ID: 18F3685C0022BFF3

View file

@ -105,6 +105,14 @@ rpm_import_repository_key() {
rm -rf "$tmpdir"
}
semverParse() {
major="${1%%.*}"
minor="${1#$major.}"
minor="${minor%%.*}"
patch="${1#$major.$minor.}"
patch="${patch%%[-.]*}"
}
do_install() {
case "$(uname -m)" in
*64)
@ -119,6 +127,21 @@ do_install() {
esac
if command_exists docker; then
version="$(docker -v | awk -F '[ ,]+' '{ print $3 }')"
MAJOR_W=1
MINOR_W=10
semverParse $version
shouldWarn=0
if [ $major -lt $MAJOR_W ]; then
shouldWarn=1
fi
if [ $major -le $MAJOR_W ] && [ $minor -lt $MINOR_W ]; then
shouldWarn=1
fi
cat >&2 <<-'EOF'
Warning: the "docker" command appears to already exist on this system.
@ -127,7 +150,23 @@ do_install() {
installation.
If you installed the current Docker package using this script and are using it
EOF
if [ $shouldWarn -eq 1 ]; then
cat >&2 <<-'EOF'
again to update Docker, we urge you to migrate your image store before upgrading
to v1.10+.
You can find instructions for this here:
https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration
EOF
else
cat >&2 <<-'EOF'
again to update Docker, you can safely ignore this message.
EOF
fi
cat >&2 <<-'EOF'
You may press Ctrl+C now to abort this script.
EOF