Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpm: always replace existing repo-configuration
The installation script's main purpose is to perform a fresh install, because it's not guaranteed to work correctly when updating an existing installation, and we print a warning if we find docker is already installed. However, it's known that the script is used to update existing installations. The current script has some limitations for the update scenario; - When using the script for installing from the staging domain, the existing repo configuration is not overwritten. When using `yum`, or older `dnf` versions this resulted in 2 separate repo files to be created (docker-ce.repo and docker-ce-staging.repo), which resulted in errors due to duplicate repo definitions with the same name. - When using `dnf5`, we specified the filename to store the configuration, which resulted in an error; + sh -c 'dnf5 config-manager addrepo --save-filename=docker-ce.repo --from-repofile='\''https://download-stage.docker.com/linux/fedora/docker-ce-staging.repo'\''' File "/etc/yum.repos.d/docker-ce.repo" already exists and configures repositories with IDs "docker-ce-stable docker-ce-stable-debuginfo docker-ce-stable-source docker-ce-test docker-ce-test-debuginfo docker-ce-test-source docker-ce-nightly docker-ce-nightly-debuginfo docker-ce-nightly-source". Add "--overwrite" to overwrite. - On SLES, it would result in a similar error; + sh -c 'zypper addrepo https://download-stage.docker.com/linux/sles/docker-ce-staging.repo' Adding repository 'Docker CE Nightly - s390x' ......................................................................................[error] Repository named 'docker-ce-nightly' already exists. Please use another alias. Adding repository 'Docker CE Nightly - Debuginfo s390x' ............................................................................[error] Repository named 'docker-ce-nightly-debuginfo' already exists. Please use another alias. This patch updates the script to overwrite / replace the existing repo config. This brings the rpm-based installations in line with the Debian approach, which unconditionally overwrites `/etc/apt/sources.list.d/docker.list`. It's worth noting that this change will therefore overwrite any customisations made to the repo-configurations, so a warning is added for that. Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information