|
| 1 | +--- 28.1.0.orig.sh 2025-04-22 12:29:33.257737659 +0530 |
| 2 | ++++ 28.1.0.sh 2025-04-22 13:28:39.009001576 +0530 |
| 3 | +@@ -82,31 +82,34 @@ |
| 4 | + # the script was uploaded (Should only be modified by upload job): |
| 5 | + SCRIPT_COMMIT_SHA="53a22f61c0628e58e1d6680b49e82993d304b449" |
| 6 | + |
| 7 | +-# strip "v" prefix if present |
| 8 | +-VERSION="${VERSION#v}" |
| 9 | +- |
| 10 | +-# The channel to install from: |
| 11 | +-# * stable |
| 12 | +-# * test |
| 13 | +-DEFAULT_CHANNEL_VALUE="stable" |
| 14 | +-if [ -z "$CHANNEL" ]; then |
| 15 | +- CHANNEL=$DEFAULT_CHANNEL_VALUE |
| 16 | +-fi |
| 17 | +- |
| 18 | +-DEFAULT_DOWNLOAD_URL="https://download.docker.com" |
| 19 | +-if [ -z "$DOWNLOAD_URL" ]; then |
| 20 | +- DOWNLOAD_URL=$DEFAULT_DOWNLOAD_URL |
| 21 | +-fi |
| 22 | +- |
| 23 | +-DEFAULT_REPO_FILE="docker-ce.repo" |
| 24 | +-if [ -z "$REPO_FILE" ]; then |
| 25 | +- REPO_FILE="$DEFAULT_REPO_FILE" |
| 26 | +- # Automatically default to a staging repo fora |
| 27 | +- # a staging download url (download-stage.docker.com) |
| 28 | +- case "$DOWNLOAD_URL" in |
| 29 | +- *-stage*) REPO_FILE="docker-ce-staging.repo";; |
| 30 | +- esac |
| 31 | +-fi |
| 32 | ++CHANNEL="stable" |
| 33 | ++DOWNLOAD_URL="https://download.docker.com" |
| 34 | ++REPO_FILE="docker-ce.repo" |
| 35 | ++VERSION="28.1.0" |
| 36 | ++DIND_TEST_WAIT=${DIND_TEST_WAIT:-3s} # Wait time until docker start at dind test env |
| 37 | ++ |
| 38 | ++# Issue https://github.com/rancher/rancher/issues/29246 |
| 39 | ++adjust_repo_releasever() { |
| 40 | ++ DOWNLOAD_URL="https://download.docker.com" |
| 41 | ++ case $1 in |
| 42 | ++ 8*) |
| 43 | ++ releasever=8 |
| 44 | ++ ;; |
| 45 | ++ 9*) |
| 46 | ++ releasever=9 |
| 47 | ++ ;; |
| 48 | ++ *) |
| 49 | ++ # fedora, or unsupported |
| 50 | ++ return |
| 51 | ++ ;; |
| 52 | ++ esac |
| 53 | ++ |
| 54 | ++ for channel in "stable" "test" "nightly"; do |
| 55 | ++ $sh_c "$config_manager --setopt=docker-ce-${channel}.baseurl=${DOWNLOAD_URL}/linux/rhel/${releasever}/\\\$basearch/${channel} --save"; |
| 56 | ++ $sh_c "$config_manager --setopt=docker-ce-${channel}-debuginfo.baseurl=${DOWNLOAD_URL}/linux/rhel/${releasever}/debug-\\\$basearch/${channel} --save"; |
| 57 | ++ $sh_c "$config_manager --setopt=docker-ce-${channel}-source.baseurl=${DOWNLOAD_URL}/linux/rhel/${releasever}/source/${channel} --save"; |
| 58 | ++ done |
| 59 | ++} |
| 60 | + |
| 61 | + mirror='' |
| 62 | + DRY_RUN=${DRY_RUN:-} |
| 63 | +@@ -157,7 +160,17 @@ |
| 64 | + exit 1 |
| 65 | + ;; |
| 66 | + esac |
| 67 | +- |
| 68 | ++start_docker() { |
| 69 | ++ if [ ! -z $DIND_TEST ]; then |
| 70 | ++ # Starting dockerd manually due to dind env is not using systemd |
| 71 | ++ dockerd & |
| 72 | ++ sleep $DIND_TEST_WAIT |
| 73 | ++ elif [ -d '/run/systemd/system' ] ; then |
| 74 | ++ $sh_c 'systemctl start docker' |
| 75 | ++ else |
| 76 | ++ $sh_c 'service docker start' |
| 77 | ++ fi |
| 78 | ++} |
| 79 | + command_exists() { |
| 80 | + command -v "$@" > /dev/null 2>&1 |
| 81 | + } |
| 82 | +@@ -457,12 +470,18 @@ |
| 83 | + esac |
| 84 | + ;; |
| 85 | + |
| 86 | +- centos|rhel) |
| 87 | ++ centos|rhel|sles|rocky) |
| 88 | + if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then |
| 89 | + dist_version="$(. /etc/os-release && echo "$VERSION_ID")" |
| 90 | + fi |
| 91 | + ;; |
| 92 | + |
| 93 | ++ oracleserver|ol) |
| 94 | ++ lsb_dist="ol" |
| 95 | ++ # need to switch lsb_dist to match yum repo URL |
| 96 | ++ dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//' | sed 's/Server*//')" |
| 97 | ++ ;; |
| 98 | ++ |
| 99 | + *) |
| 100 | + if command_exists lsb_release; then |
| 101 | + dist_version="$(lsb_release --release | cut -f2)" |
| 102 | +@@ -560,16 +579,20 @@ |
| 103 | + set -x |
| 104 | + fi |
| 105 | + $sh_c "DEBIAN_FRONTEND=noninteractive apt-get -y -qq install $pkgs >/dev/null" |
| 106 | ++ start_docker |
| 107 | + ) |
| 108 | + echo_docker_as_nonroot |
| 109 | + exit 0 |
| 110 | + ;; |
| 111 | +- centos|fedora|rhel) |
| 112 | ++ centos|fedora|rhel|ol|rocky) |
| 113 | + if [ "$(uname -m)" = "s390x" ]; then |
| 114 | + echo "Effective v27.5, please consult RHEL distro statement for s390x support." |
| 115 | + exit 1 |
| 116 | + fi |
| 117 | + repo_file_url="$DOWNLOAD_URL/linux/$lsb_dist/$REPO_FILE" |
| 118 | ++ if [ "$lsb_dist" = "ol" ] || [ "$lsb_dist" = "rocky" ] || [ "$lsb_dist" = "rhel" ]; then |
| 119 | ++ repo_file_url="$DOWNLOAD_URL/linux/rhel/$REPO_FILE" |
| 120 | ++ fi |
| 121 | + ( |
| 122 | + if ! is_dry_run; then |
| 123 | + set -x |
| 124 | +@@ -663,13 +686,107 @@ |
| 125 | + fi |
| 126 | + $sh_c "$pkg_manager $pkg_manager_flags install $pkgs" |
| 127 | + ) |
| 128 | +- echo_docker_as_nonroot |
| 129 | ++ echo_docker_as_nonroot |
| 130 | + exit 0 |
| 131 | + ;; |
| 132 | + sles) |
| 133 | +- echo "Effective v27.5, please consult SLES distro statement for s390x support." |
| 134 | +- exit 1 |
| 135 | ++ if [ "$(uname -m)" != "s390x" ]; then |
| 136 | ++ echo "Packages for SLES are currently only available for s390x" |
| 137 | ++ exit 1 |
| 138 | ++ fi |
| 139 | ++ if [ "$dist_version" = "15.3" ]; then |
| 140 | ++ sles_version="SLE_15_SP3" |
| 141 | ++ else |
| 142 | ++ sles_version="SLE_15_SP2" |
| 143 | ++ fi |
| 144 | ++ repo_file_url="$DOWNLOAD_URL/linux/$lsb_dist/$REPO_FILE" |
| 145 | ++ pre_reqs="ca-certificates curl libseccomp2 awk" |
| 146 | ++ ( |
| 147 | ++ if ! is_dry_run; then |
| 148 | ++ set -x |
| 149 | ++ fi |
| 150 | ++ $sh_c "zypper install -y $pre_reqs" |
| 151 | ++ $sh_c "rm -f /etc/zypp/repos.d/docker-ce-*.repo" |
| 152 | ++ $sh_c "zypper addrepo $repo_file_url" |
| 153 | ++ |
| 154 | ++ opensuse_factory_url="https://download.opensuse.org/repositories/security:/SELinux/openSUSE_Factory/" |
| 155 | ++ if ! zypper lr -d | grep -q "${opensuse_factory_url}"; then |
| 156 | ++ opensuse_repo="${opensuse_factory_url}security:SELinux.repo" |
| 157 | ++ if ! is_dry_run; then |
| 158 | ++ cat >&2 <<- EOF |
| 159 | ++ WARNING!! |
| 160 | ++ openSUSE repository ($opensuse_repo) will be enabled now. |
| 161 | ++ Do you wish to continue? |
| 162 | ++ You may press Ctrl+C now to abort this script. |
| 163 | ++ EOF |
| 164 | ++ ( set -x; sleep 20 ) |
| 165 | ++ fi |
| 166 | ++ $sh_c "zypper addrepo $opensuse_repo" |
| 167 | ++ fi |
| 168 | ++ $sh_c "zypper --gpg-auto-import-keys refresh" |
| 169 | ++ $sh_c "zypper lr -d" |
| 170 | ++ ) |
| 171 | ++ pkg_version="" |
| 172 | ++ if [ -n "$VERSION" ]; then |
| 173 | ++ if is_dry_run; then |
| 174 | ++ echo "# WARNING: VERSION pinning is not supported in DRY_RUN" |
| 175 | ++ else |
| 176 | ++ pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/\\\\.ce.*/g' | sed 's/-/.*/g')" |
| 177 | ++ search_command="zypper search -s --match-exact 'docker-ce' | grep '$pkg_pattern' | tail -1 | awk '{print \$6}'" |
| 178 | ++ pkg_version="$($sh_c "$search_command")" |
| 179 | ++ echo "INFO: Searching repository for VERSION '$VERSION'" |
| 180 | ++ echo "INFO: $search_command" |
| 181 | ++ if [ -z "$pkg_version" ]; then |
| 182 | ++ echo |
| 183 | ++ echo "ERROR: '$VERSION' not found amongst zypper list results" |
| 184 | ++ echo |
| 185 | ++ exit 1 |
| 186 | ++ fi |
| 187 | ++ search_command="zypper search -s --match-exact 'docker-ce-cli' | grep '$pkg_pattern' | tail -1 | awk '{print \$6}'" |
| 188 | ++ # It's okay for cli_pkg_version to be blank, since older versions don't support a cli package |
| 189 | ++ cli_pkg_version="$($sh_c "$search_command")" |
| 190 | ++ pkg_version="-$pkg_version" |
| 191 | ++ fi |
| 192 | ++ fi |
| 193 | ++ ( |
| 194 | ++ pkgs="docker-ce$pkg_version" |
| 195 | ++ if version_gte "18.09"; then |
| 196 | ++ if [ -n "$cli_pkg_version" ]; then |
| 197 | ++ # older versions didn't ship the cli and containerd as separate packages |
| 198 | ++ pkgs="$pkgs docker-ce-cli-$cli_pkg_version containerd.io" |
| 199 | ++ else |
| 200 | ++ pkgs="$pkgs docker-ce-cli containerd.io" |
| 201 | ++ fi |
| 202 | ++ fi |
| 203 | ++ if version_gte "20.10"; then |
| 204 | ++ pkgs="$pkgs docker-compose-plugin docker-ce-rootless-extras$pkg_version" |
| 205 | ++ fi |
| 206 | ++ if version_gte "23.0"; then |
| 207 | ++ pkgs="$pkgs docker-buildx-plugin" |
| 208 | ++ fi |
| 209 | ++ if ! is_dry_run; then |
| 210 | ++ set -x |
| 211 | ++ fi |
| 212 | ++ $sh_c "zypper -q install -y $pkgs" |
| 213 | ++ if ! command_exists iptables; then |
| 214 | ++ $sh_c "$pkg_manager install -y -q iptables" |
| 215 | ++ fi |
| 216 | ++ start_docker |
| 217 | ++ ) |
| 218 | ++ echo_docker_as_nonroot |
| 219 | ++ exit 0 |
| 220 | + ;; |
| 221 | ++ rancheros) |
| 222 | ++ ( |
| 223 | ++ set -x |
| 224 | ++ $sh_c "sleep 3;ros engine list --update" |
| 225 | ++ engine_version="$(sudo ros engine list | awk '{print $2}' | grep ${docker_version} | tail -n 1)" |
| 226 | ++ if [ "$engine_version" != "" ]; then |
| 227 | ++ $sh_c "ros engine switch -f $engine_version" |
| 228 | ++ fi |
| 229 | ++ ) |
| 230 | ++ exit 0 |
| 231 | ++ ;; |
| 232 | + *) |
| 233 | + if [ -z "$lsb_dist" ]; then |
| 234 | + if is_darwin; then |
0 commit comments