add warning if upgrading via script to migrate
| ... | ... |
@@ -105,6 +105,14 @@ rpm_import_repository_key() {
|
| 105 | 105 |
rm -rf "$tmpdir" |
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 |
+semverParse() {
|
|
| 109 |
+ major="${1%%.*}"
|
|
| 110 |
+ minor="${1#$major.}"
|
|
| 111 |
+ minor="${minor%%.*}"
|
|
| 112 |
+ patch="${1#$major.$minor.}"
|
|
| 113 |
+ patch="${patch%%[-.]*}"
|
|
| 114 |
+} |
|
| 115 |
+ |
|
| 108 | 116 |
do_install() {
|
| 109 | 117 |
case "$(uname -m)" in |
| 110 | 118 |
*64) |
| ... | ... |
@@ -119,6 +127,21 @@ do_install() {
|
| 119 | 119 |
esac |
| 120 | 120 |
|
| 121 | 121 |
if command_exists docker; then |
| 122 |
+ version="$(docker -v | awk -F '[ ,]+' '{ print $3 }')"
|
|
| 123 |
+ MAJOR_W=1 |
|
| 124 |
+ MINOR_W=10 |
|
| 125 |
+ |
|
| 126 |
+ semverParse $version |
|
| 127 |
+ |
|
| 128 |
+ shouldWarn=0 |
|
| 129 |
+ if [ $major -lt $MAJOR_W ]; then |
|
| 130 |
+ shouldWarn=1 |
|
| 131 |
+ fi |
|
| 132 |
+ |
|
| 133 |
+ if [ $major -le $MAJOR_W ] && [ $minor -lt $MINOR_W ]; then |
|
| 134 |
+ shouldWarn=1 |
|
| 135 |
+ fi |
|
| 136 |
+ |
|
| 122 | 137 |
cat >&2 <<-'EOF' |
| 123 | 138 |
Warning: the "docker" command appears to already exist on this system. |
| 124 | 139 |
|
| ... | ... |
@@ -127,7 +150,23 @@ do_install() {
|
| 127 | 127 |
installation. |
| 128 | 128 |
|
| 129 | 129 |
If you installed the current Docker package using this script and are using it |
| 130 |
+ EOF |
|
| 131 |
+ |
|
| 132 |
+ if [ $shouldWarn -eq 1 ]; then |
|
| 133 |
+ cat >&2 <<-'EOF' |
|
| 134 |
+ again to update Docker, we urge you to migrate your image store before upgrading |
|
| 135 |
+ to v1.10+. |
|
| 136 |
+ |
|
| 137 |
+ You can find instructions for this here: |
|
| 138 |
+ https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration |
|
| 139 |
+ EOF |
|
| 140 |
+ else |
|
| 141 |
+ cat >&2 <<-'EOF' |
|
| 130 | 142 |
again to update Docker, you can safely ignore this message. |
| 143 |
+ EOF |
|
| 144 |
+ fi |
|
| 145 |
+ |
|
| 146 |
+ cat >&2 <<-'EOF' |
|
| 131 | 147 |
|
| 132 | 148 |
You may press Ctrl+C now to abort this script. |
| 133 | 149 |
EOF |