From 9b2cd0e08dfe6566e087a8f17a2bb013b12f63ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Wed, 17 Sep 2025 17:31:27 +0200 Subject: [PATCH] Add --setup-repo option to configure repositories without installing packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `--setup-repo` flag allows users to add Docker package repositories to without automatically installing Docker packages. This is useful for scenarios where users want to configure the repository but handle package installation separately. Signed-off-by: Paweł Gronowski --- install.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/install.sh b/install.sh index 0ef4757..424c976 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"