diff --git a/install.sh b/install.sh index 0ef47571..424c9763 100755 --- a/install.sh +++ b/install.sh @@ -75,6 +75,14 @@ set -e # # $ sudo sh install-docker.sh --mirror AzureChinaCloud # +# --setup-repo +# +# Use the --setup-repo option to configure Docker's package repositories without +# installing Docker packages. This is useful when you want to add the repository +# but install packages separately: +# +# $ sudo sh install-docker.sh --setup-repo +# # ============================================================================== @@ -110,6 +118,7 @@ fi mirror='' DRY_RUN=${DRY_RUN:-} +REPO_ONLY=${REPO_ONLY:-0} while [ $# -gt 0 ]; do case "$1" in --channel) @@ -127,6 +136,10 @@ while [ $# -gt 0 ]; do VERSION="${2#v}" shift ;; + --setup-repo) + REPO_ONLY=1 + shift + ;; --*) echo "Illegal option $1" ;; @@ -519,6 +532,11 @@ do_install() { $sh_c "echo \"$apt_repo\" > /etc/apt/sources.list.d/docker.list" $sh_c 'apt-get -qq update >/dev/null' ) + + if [ "$REPO_ONLY" = "1" ]; then + exit 0 + fi + pkg_version="" if [ -n "$VERSION" ]; then if is_dry_run; then @@ -608,6 +626,11 @@ do_install() { $sh_c "yum makecache" fi ) + + if [ "$REPO_ONLY" = "1" ]; then + exit 0 + fi + pkg_version="" if command_exists dnf; then pkg_manager="dnf"