From 6b8a1f5972c02ecd6c841541bf8f0cc74e441446 Mon Sep 17 00:00:00 2001 From: "Rynkiewicz, Michael" Date: Tue, 1 Jul 2025 09:13:58 +0200 Subject: [PATCH] adds option to keep older packages --- README.md | 24 ++++----- .../mirror-update_test.cpython-313.pyc | Bin 0 -> 2209 bytes example.yml | 9 +--- mirror-update | 10 +++- mirror-update_test.py | 49 ++++++++++++++++++ 5 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 __pycache__/mirror-update_test.cpython-313.pyc create mode 100644 mirror-update_test.py diff --git a/README.md b/README.md index 8d7e4e3..ac17efb 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,8 @@ A script to create and update mirrors of RPM repositories using `reposync`. Runs on -* RHEL 8 (and compatible) -* RHEL 9 (and compatible) - +- RHEL 8 (and compatible) +- RHEL 9 (and compatible) ## Installation @@ -57,7 +56,6 @@ setfacl --recursive --modify user:mirror:rwx "$base_path" setfacl --default --recursive --modify user:mirror:rwx "$base_path" ``` - ## How to Provide a RPM-based Repository on your Mirror Server If you want to provide an RPM-based repository, it must be present in `/etc/yum.repos.d`. However, it does not need to be enabled, so we generally recommend disabling it (to prevent the mirror server itself from accidentally using it). @@ -79,10 +77,10 @@ module_hotfixes = 1 In `/etc/mirror.yml`, set the location for the repo to be mirrored. This path should be unique to prevent multiple repos from overwriting each other. The path will then be created by the script. ```yaml -base_path: '/var/www/html/mirror' +base_path: "/var/www/html/mirror" reposync_repos: - - repoid: 'mirror-rhel8-mariadb-10.6' - relative_target_path: 'MariaDB/mariadb-10.6/yum/rhel/8/x86_64' + - repoid: "mirror-rhel8-mariadb-10.6" + relative_target_path: "MariaDB/mariadb-10.6/yum/rhel/8/x86_64" ``` Determine whether or not it is necessary to run `createrepo`. If the mirrored repo is not identical to the upstream repo (e.g. due to `includepkgs` or `excludepkgs` directives), you need to run `createrepo`. If this is not the case, you should avoid running it, as it will destroy RHEL's module information. @@ -107,12 +105,12 @@ restorecon -Fvr $BASE_PATH `reposync_repos`: Optional, list. List of repositories to mirror using `reposync`.
Subkeys: -* `repoid`: Mandatory, string. Repo-ID. Can be found using `dnf repolist`. -* `relative_target_path`: Mandatory, string. Target path where the repo should be placed, relative to `base_path`. -* `createrepo`: Optional, boolean. If `createrepo` should be ran on the repo after mirroring or not. Only use this if the mirrored repo is not idential to the upstream repo (for example due to `includepkgs` or `excludepkgs` directives). Else, you should avoid running it, since it destroys RHEL's module information. Defaults to `false`. - +- `repoid`: Mandatory, string. Repo-ID. Can be found using `dnf repolist`. +- `relative_target_path`: Mandatory, string. Target path where the repo should be placed, relative to `base_path`. +- `createrepo`: Optional, boolean. If `createrepo` should be ran on the repo after mirroring or not. Only use this if the mirrored repo is not idential to the upstream repo (for example due to `includepkgs` or `excludepkgs` directives). Else, you should avoid running it, since it destroys RHEL's module information. Defaults to `false`. +- `keep_old_rpms`: Optional, boolean. If set to `true`, the reposync command is executed without the `--delete` flag to keep older packages. Defaults to `false`. ## Exit Codes -* 0: success / config valid -* 1: failed to read config / config invalid +- 0: success / config valid +- 1: failed to read config / config invalid diff --git a/__pycache__/mirror-update_test.cpython-313.pyc b/__pycache__/mirror-update_test.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..96f68b1e0b7da3f439aa1974bfff6010533914fd GIT binary patch literal 2209 zcmd5-&2Jk;6rcUDv-Uc1A)oySNl8UyM~=CqQu!!q+LRzf8f9$>iAtmG?$}wnAMWg0 zsZ#}zkRakz4wZ83u{prsfDr#c)I+S{Qi)S@~4wvUkCQ0b0DN7%av!UJLuL;9F-GDhAchJ1z?%1yE&ca4v}b4pw0 za#hNyPf=O2j+P0LI?CQ82oK0j!X<-n*^sz`ez|HWfC)q8$!a2(6t9<97+noK&-Cs2 zy5ri6KgAeU*Ae>D;D?iYKLbFrk}nyup}Z~mvZ1c@TEaSxvTVqB!m?x}F3G-PB+K%< zU}vY|wIr??eeZlqhzVj@F|-2AfL-cDZ;Fw=B>8HYtaOeK#)qS<8v2R5j^!}dxy(sY zCArMfL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