Disable OS main to latest branch symlink in repo mirror sync


We have a mirror server we sync from repo.alma. However, when a new OS branch is sync’d example 8.7, the symlink for alma8 is symlinked to 8.7 here:

[root@our-local-repo:/root]$ ls -lh /repo/mirrors/almalinux
total 32K
lrwxrwxrwx  1 root root    3 Nov 10 09:37 8 -> 8.7/
lrwxrwxrwx  1 root root    3 Nov 16 17:05 9 -> 9.1/

We wish to sync the mirror repo, but just wish to avoid the main OS version symlinked to latest OS branch (alma8 to 8.7 or alma9 to 9.1) - because our TFT images are last OS version and build fails due to this - how can I achieve this?

We wish to manually link as we are confirmable and netboot images are loaded into our netboot servers. Help.

I would say to rsync the minor versions and set the symlink yourself - so in the below you would need to rsync 8.6 but not 8, then set the symlink from 8.6 to 8 yourself:

8/                                                 10-Nov-2022 15:26                   -
8.6/                                               10-Nov-2022 12:40                   -
8.7/                                               10-Nov-2022 15:26                   -
9/                                                 16-Nov-2022 21:44                   -
9.0/                                               20-Jun-2022 16:54                   -
9.1/                                               16-Nov-2022 21:44                   -

and use rsync --exclude '8' or maybe even rsync --no-links

or you could just mirror everything and in your .repo file on the clients replace $releasever with a hardcoded 8.6

1 Like

I am thinking to do following:

alma_versions=( 8.6 8.7 9.1)
for alma_version in ${alma_versions[@]}; do
  /usr/bin/flock -n /var/run/almalinux_rsync-"${alma_version}"-.lock -c "/usr/bin/rsync -avSH -f 'R .~tmp~' --delete-delay --delay-updates rsync://rsync.repo.almalinux.org/almalinux/${alma_version} ${alma_local_repo_dir}/${alma_version}"
  sleep 5;

Then symlink : /repo/mirrors/almalinux-major/8 → /repo/mirrors/almalinux-minor/8.7

The problem is if this gets sync’d /repo/mirrors/almalinux-major/8 and wondering it will reset my symlink to /repo/mirrors/almalinux-major/8 → /repo/mirrors/almalinux-major/8.8 etc

rsync --no-links - scares me, I noticed there some symlinks in netboot images / packages and repo might break.

Just wished if I could skip that one $major → $latest_minor symink. Thank you so much for your reply.

There are no more updates to 8.6. (Or, did it go to vault already?)

I have something like

[ -f $LOCKFILE ] && exit 0
trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
RSYNC="/usr/bin/rsync -aqH --no-g --no-o --delete --delay-updates --bwlimit=1024"
MIRROR=rsync://rsync.nic.funet.fi/ftp/pub/mirrors/almalinux.org # closest official mirror

for R in BaseOS AppStream PowerTools extras
  ${RSYNC} ${SOURCE}/${R}/x86_64/os/ ${DEST}/${R}/x86_64/os/

But it lacks the initial

mkdir -p /site/mirrors/almalinux.org/8.7/{BaseOS,AppStream,PowerTools,extras}/x86_64/os

and the ‘8’ symlink I update manually too. (It’s only twice a year.)

1 Like

I had repo sync/mirror in:

I did the following:
mkdir /repo/mirrors/alma_custom_repo_link/
ln -s /repo/mirrors/almalinux/8.7 /repo/mirrors/alma_custom_repo_link/8.7
ln -s /repo/mirrors/alma_custom_repo_link/8.7 /repo/mirrors/alma_custom_repo_link/8

And updated baseurl as:

So, /repo/mirrors/almalinux changes symlink by chance, won’t effect me as I use my custom symlink :slight_smile:

Actually, I finally ruck with this:

alma_versions=( 8.6 8.7 9.1 )
for alma_version in ${alma_versions[@]}; do
  /usr/bin/flock -n /var/run/almalinux_rsync-"${alma_version}"-.lock -c "/usr/bin/rsync -avSH -f 'R .~tmp~' --delete-delay --delay-updates rsync://rsync.repo.almalinux.org/almalinux/${alma_version} ${alma_local_repo_dir}/"
  sleep 5;

You have “rsync --delete” and you are still syncing 8.6. That means that when the 8.6 is moved to vault (should happen soon), your mirror copy will be wiped.

You need have to stop syncing the 8.6, or you will lose your copy (unless that is your intention).

(The last addition to 8.6 was made before 8.7 was released.)

1 Like