Skip to content

Commit 9b2cd0e

Browse files
committed
Add --setup-repo option to configure repositories without installing packages
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 <pawel.gronowski@docker.com>
1 parent 30c930e commit 9b2cd0e

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

install.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ set -e
7575
#
7676
# $ sudo sh install-docker.sh --mirror AzureChinaCloud
7777
#
78+
# --setup-repo
79+
#
80+
# Use the --setup-repo option to configure Docker's package repositories without
81+
# installing Docker packages. This is useful when you want to add the repository
82+
# but install packages separately:
83+
#
84+
# $ sudo sh install-docker.sh --setup-repo
85+
#
7886
# ==============================================================================
7987

8088

@@ -110,6 +118,7 @@ fi
110118

111119
mirror=''
112120
DRY_RUN=${DRY_RUN:-}
121+
REPO_ONLY=${REPO_ONLY:-0}
113122
while [ $# -gt 0 ]; do
114123
case "$1" in
115124
--channel)
@@ -127,6 +136,10 @@ while [ $# -gt 0 ]; do
127136
VERSION="${2#v}"
128137
shift
129138
;;
139+
--setup-repo)
140+
REPO_ONLY=1
141+
shift
142+
;;
130143
--*)
131144
echo "Illegal option $1"
132145
;;
@@ -519,6 +532,11 @@ do_install() {
519532
$sh_c "echo \"$apt_repo\" > /etc/apt/sources.list.d/docker.list"
520533
$sh_c 'apt-get -qq update >/dev/null'
521534
)
535+
536+
if [ "$REPO_ONLY" = "1" ]; then
537+
exit 0
538+
fi
539+
522540
pkg_version=""
523541
if [ -n "$VERSION" ]; then
524542
if is_dry_run; then
@@ -608,6 +626,11 @@ do_install() {
608626
$sh_c "yum makecache"
609627
fi
610628
)
629+
630+
if [ "$REPO_ONLY" = "1" ]; then
631+
exit 0
632+
fi
633+
611634
pkg_version=""
612635
if command_exists dnf; then
613636
pkg_manager="dnf"

0 commit comments

Comments
 (0)