Skip to content

Commit 85ace00

Browse files
committed
Add --repo-only option to configure repositories without installing packages
The `--repo-only` 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 <[email protected]>
1 parent 30c930e commit 85ace00

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

install.sh

Lines changed: 25 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+
# --repo-only
79+
#
80+
# Use the --repo-only 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 --repo-only
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+
--repo-only)
140+
REPO_ONLY=1
141+
shift
142+
;;
130143
--*)
131144
echo "Illegal option $1"
132145
;;
@@ -519,6 +532,12 @@ 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+
echo "Skipping package installation due to --repo-only flag." >&2
538+
exit 0
539+
fi
540+
522541
pkg_version=""
523542
if [ -n "$VERSION" ]; then
524543
if is_dry_run; then
@@ -608,6 +627,12 @@ do_install() {
608627
$sh_c "yum makecache"
609628
fi
610629
)
630+
631+
if [ "$REPO_ONLY" = "1" ]; then
632+
echo "Skipping package installation due to --repo-only flag." >&2
633+
exit 0
634+
fi
635+
611636
pkg_version=""
612637
if command_exists dnf; then
613638
pkg_manager="dnf"

0 commit comments

Comments
 (0)