@@ -341,7 +341,7 @@ do_install() {
341341 esac
342342 ;;
343343
344- centos|rhel)
344+ centos|rhel|sles )
345345 if [ -z " $dist_version " ] && [ -r /etc/os-release ]; then
346346 dist_version=" $( . /etc/os-release && echo " $VERSION_ID " ) "
347347 fi
@@ -447,6 +447,10 @@ do_install() {
447447 exit 0
448448 ;;
449449 centos|fedora|rhel)
450+ if [ " $( uname -m) " != " s390x" ] && [ " $lsb_dist " = " rhel" ]; then
451+ echo " Packages for RHEL are currently only available for s390x."
452+ exit 1
453+ fi
450454 yum_repo=" $DOWNLOAD_URL /linux/$lsb_dist /$REPO_FILE "
451455 if ! curl -Ifs " $yum_repo " > /dev/null; then
452456 echo " Error: Unable to curl repository file $yum_repo , is it valid?"
@@ -521,6 +525,79 @@ do_install() {
521525 echo_docker_as_nonroot
522526 exit 0
523527 ;;
528+ sles)
529+ if [ " $( uname -m) " != " s390x" ]; then
530+ echo " Packages for SLES are currently only available for s390x"
531+ exit 1
532+ fi
533+ sles_repo=" $DOWNLOAD_URL /linux/$lsb_dist /$REPO_FILE "
534+ opensuse_repo=" https://download.opensuse.org/repositories/security:SELinux/SLE_15_SP2/security:SELinux.repo"
535+ if ! curl -Ifs " $sles_repo " > /dev/null; then
536+ echo " Error: Unable to curl repository file $sles_repo , is it valid?"
537+ exit 1
538+ fi
539+ pre_reqs=" ca-certificates curl libseccomp2 awk"
540+ (
541+ if ! is_dry_run; then
542+ set -x
543+ fi
544+ $sh_c " zypper install -y $pre_reqs "
545+ $sh_c " zypper addrepo $sles_repo "
546+ if ! is_dry_run; then
547+ cat >&2 << -'EOF '
548+ WARNING!!
549+ openSUSE repository (https://download.opensuse.org/repositories/security:SELinux) will be enabled now.
550+ Do you wish to continue?
551+ You may press Ctrl+C now to abort this script.
552+ EOF
553+ ( set -x; sleep 30 )
554+ fi
555+ $sh_c " zypper addrepo $opensuse_repo "
556+ $sh_c " zypper --gpg-auto-import-keys refresh"
557+ $sh_c " zypper lr -d"
558+ )
559+ pkg_version=" "
560+ if [ -n " $VERSION " ]; then
561+ if is_dry_run; then
562+ echo " # WARNING: VERSION pinning is not supported in DRY_RUN"
563+ else
564+ pkg_pattern=" $( echo " $VERSION " | sed " s/-ce-/\\\\ .ce.*/g" | sed " s/-/.*/g" ) "
565+ search_command=" zypper search -s --match-exact 'docker-ce' | grep '$pkg_pattern ' | tail -1 | awk '{print \$ 6}'"
566+ pkg_version=" $( $sh_c " $search_command " ) "
567+ echo " INFO: Searching repository for VERSION '$VERSION '"
568+ echo " INFO: $search_command "
569+ if [ -z " $pkg_version " ]; then
570+ echo
571+ echo " ERROR: '$VERSION ' not found amongst zypper list results"
572+ echo
573+ exit 1
574+ fi
575+ search_command=" zypper search -s --match-exact 'docker-ce-cli' | grep '$pkg_pattern ' | tail -1 | awk '{print \$ 6}'"
576+ # It's okay for cli_pkg_version to be blank, since older versions don't support a cli package
577+ cli_pkg_version=" $( $sh_c " $search_command " ) "
578+ pkg_version=" -$pkg_version "
579+
580+ search_command=" zypper search -s --match-exact 'docker-ce-rootless-extras' | grep '$pkg_pattern ' | tail -1 | awk '{print \$ 6}'"
581+ rootless_pkg_version=" $( $sh_c " $search_command " ) "
582+ rootless_pkg_version=" -$rootless_pkg_version "
583+ fi
584+ fi
585+ (
586+ if ! is_dry_run; then
587+ set -x
588+ fi
589+ # install the correct cli version first
590+ if [ -n " $cli_pkg_version " ]; then
591+ $sh_c " zypper install -y docker-ce-cli-$cli_pkg_version "
592+ fi
593+ $sh_c " zypper install -y docker-ce$pkg_version "
594+ if version_gte " 20.10" ; then
595+ $sh_c " zypper install -y docker-ce-rootless-extras$rootless_pkg_version "
596+ fi
597+ )
598+ echo_docker_as_nonroot
599+ exit 0
600+ ;;
524601 * )
525602 if [ -z " $lsb_dist " ]; then
526603 if is_darwin; then
0 commit comments