diff options
author | Tyler Todd <ttodd@jurassicinnovations.com> | 2024-08-06 07:10:28 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2024-08-06 07:10:28 +0200 |
commit | 994c2d5649ba4a4768ac2ad327ac773e0bf32997 (patch) | |
tree | 212d3442bfdf41ede984104e0d40ad4d2ea9e12d /mirrorsync | |
parent | 9e1002b4bd54e3b961a521a48ddab084a84acc10 (diff) |
mirrorsync: improve headers and comments
Diffstat (limited to 'mirrorsync')
-rw-r--r-- | mirrorsync | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -1,14 +1,15 @@ #!/bin/env bash # -# mirrorsync - Synchronize a Rocky mirror -# By: Dennis Koerner <koerner@netzwerge.de> +# mirrorsync - Synchronize a local mirror of Remi's RPMS Repository +# By: Tyler Todd <ttodd@jurassicinnovations.com> +# Version: 20240805.01 # # The latest version of this script can be found at: +# https://git.remirepo.net/cgit/tools/helpers.git/plain/mirrorsync +# +# Inspired from Rocky Linux Mirror Sync: # https://github.com/rocky-linux/rocky-tools # -# Please read https://docs.rockylinux.org/guides/mirror_management/add_mirror_manager/ -# for further information on setting up a Rocky mirror. -# # Copyright (c) 2021 Rocky Enterprise Software Foundation # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -48,12 +49,17 @@ opts=(-avSH --exclude="*.~tmp~" --delete-delay --delay-updates) # Please use a mirror geographically close to you for initial sync, # or if you are hosting a private mirror (not publicly available). # -# Note that local mirrors may be faster, and we might restrict -# access to the master in the future. +# Note that local mirrors may be faster +# Running rsync from the main "rsync://rpms.remirepo.net" requires +# the source IPv4 and IPv6 addresses to be allowed by Remi. Please contact +# Remi at remi@remirepo.net to get the process started. # # A complete list of mirrors can be found at -# https://mirrors.rockylinux.org/mirrormanager/mirrors/Rocky +# https://rpms.remirepo.net/ + +# Enterprise repo source src1="rsync://rpms.remirepo.net/enterprise/" +# Fedora repo source src2="rsync://rpms.remirepo.net/fedora/" # Your local path. Change to whatever fits your system. @@ -66,11 +72,19 @@ datefile="date" lockfile="$0.lockfile" logfile="$0.log" +# Always pull the index.html to ensure the latest. curl/wget would still use same bandiwdth to check if the page changed even +# if we aren't going to save a new copy +wget https://rpms.remirepo.net/index.html -O /mnt/RepoSync/${mirrormodule}/index.html + # Check if the datefile has changed on upstream mirror # and exit cleanly if it is still the same + +#Enterprise repo check checkresult1=$(rsync_run --no-motd --dry-run --out-format="%n" "${src1}/${datefile}" "${dst1}/${datefile}") +#Fedora repo check checkresult2=$(rsync_run --no-motd --dry-run --out-format="%n" "${src2}/${datefile}" "${dst2}/${datefile}") +# If both dates haven't changed, exit if [[ -z "$checkresult1" && -z "$checkresult2" ]]; then printf "%s unchanged. Not updating at %(%c)T\n" "$datefile" -1 >> "$logfile" 2>&1 logger -t rsync "Not updating ${mirrormodule}: ${datefile} unchanged." @@ -93,7 +107,7 @@ fi printf '%s\n' "$$" > "$lockfile" printf "Started update at %(%c)T\n" -1 >> "$logfile" 2>&1 logger -t rsync "Updating ${mirrormodule}" -wget https://rpms.remirepo.net/index.html -O /mnt/RepoSync/${mirrormodule}/index.html + # Sync src1/dst1 if there are changes if [[ -n "$checkresult1" ]]; then @@ -107,4 +121,4 @@ fi logger -t rsync "Finished updating ${mirrormodule}" printf "End: %(%c)T\n" -1 >> "$logfile" 2>&1 -rm -f "$lockfile" +rm -f "$lockfile"
\ No newline at end of file |