Tools to mirror Linux distro repositories. https://r00t2.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
8.7 KiB

<?xml version="1.0" encoding="UTF-8" ?>
<!--
This is by default placed in ~/.config/repomirror.xml
Remember to replace any necessary special characters (https://stackoverflow.com/a/1091953/733214).
Also, your mirror server should definitely be using UTC. You're going to see a LOT of weirdness if not.
-->
<mirror xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://git.square-r00t.net/RepoMirror/"
xsi:schemaLocation="https://git.square-r00t.net/RepoMirror/ http://schema.xml.r00t2.io/projects/repomirror.xsd">
<distro name="arch">
<!--
If provided (and the sync script is running as the root user), the files/directories can be chowned to the
provided user/group. Otherwise they'll be owned by whatever user the script is running as (and its primary group).
-->
<owner>
<user>root</user>
<group>root</group>
</owner>
<!--
The local path to where the hierarchy/files should be synced to.
-->
<dest>/srv/repos/arch/.</dest>
<!--
The local file to update with a timestamp with the last time we *checked* for updates.
If not provided, don't update a file (NOT recommended!).
It may or may not be optional; check with the spec for mirroring for the specified distro.
If the timeFormat attribute is provided, write the timestamp format in the specified format.
See the following for details:
* https://docs.python.org/library/datetime.html#strftime-and-strptime-format-codes
* https://strftime.org/
The default is to use a regular UNIX Epoch integer (e.g. June 13, 2020 5:03:53 PM UTC => 1592067833).
This can be manually specified by the special string "UNIX_EPOCH".
Optionally, you can use the special string "MICROSECOND_EPOCH", which will specify the above with left-padded
microseconds (e.g. June 13, 2020 5:09:13.995777 PM UTC => 1592068153.995777).
-->
<lastLocalCheck timeFormat="MICROSECOND_EPOCH">/srv/http/arch.lastcheck</lastLocalCheck>
<!--
The file to update with a timestamp with the last time we *synced from our upstream*.
If not provided, don't update a file (NOT recommended!).
It may or may not be optional; check with the spec for mirroring for the specified distro.
If not provided, don't update a file (NOT recommended!).
It takes the same optional attribute "timeFormat" as above, with the same behaviour.
-->
<lastLocalSync timeFormat="UNIX_EPOCH">/srv/repos/arch/lastsync</lastLocalSync>
<!--
The path to a file on the upstream(s) that gives a time when it last updated.
The syntax and options are the same as lastLocalCheck/lastLocalSync.
If neither this nor lastRemoteSync is provided, a sync will be attempted regardless of when the last one was
attempted.
-->
<!--
Remote timestamps take an additional optional boolean attribute, "mtime". If true, the mtime of the remote file
will be checked instead of the content of the file (and thus timeFormat is ignored).
-->
<lastRemoteUpdate timeFormat="UNIX_EPOCH">/lastupdate</lastRemoteUpdate>
<!--
The path to a file on the upstream(s) that gives a time when it last synced from its upstream.
The syntax and options are the same as lastRemoteCheck.
If neither this nor lastRemoteUpdate is provided, a sync will be attempted regardless of when the last one was
attempted. It follows the same rules as lastRemoteUpdate for syntax.
-->
<lastRemoteSync mtime="true" timeFormat="UNIX_EPOCH">/lastsync</lastRemoteSync>
<!--
The path that must be currently mounted for sync to proceed.
This is required.
-->
<mountCheck>/</mountCheck>
<!--
You cannot reliably use two dashes in XML strings, so this is a workaround.
The following is only used for rsync upstreams and is optional. The default is the following:
<rsyncArgs>
<long>recursive</long>
<long>times</long>
<long>links</long>
<long>hard-links</long>
<long>delete-after</long>
<long>perms</long>
<long>delay-updates</long>
<long>safe-links</long>
<long>delete-excluded</long>
</rsyncArgs>
These arguments should be sane for most, if not all, rsync-driven repository mirroring.
If arguments are provided, the defaults are overwritten so if you need the above, be sure to specify them.
See the rsync man page (rsync(1)) for more details and a listing of supported flags on your system
(§ "OPTION SUMMARY", § "OPTIONS").
-->
<rsyncArgs>
<!--
A "long" option (two hyphens).
-->
<long>archive</long>
<long>delete-after</long>
<!--
An argument with a value (info=progress2).
-->
<long value="progress2">info</long>
<!--
A "short" option (single hyphen).
-->
<short>c</short><!-- checksum -->
<!--
An option that requires to be enclosed in quotes. (This one excludes hidden files/directories.)
-->
<long value="&quot;.*&quot;">exclude</long>
</rsyncArgs>
<!--
rsyncIgnore is an optional element that ignores certain return codes/exit statuses of rsync (otherwise they are
raised as warnings). It consists of a space-separated list of return codes that warnings should be suppressed for.
(Return code 0 never raises a warning, as it is success.)
See the rsync man page (rsync(1)) for a list of error codes and what they mean (§ "EXIT VALUES"), or refer to:
repomirror/fetcher/rsync_returns.py
-->
<rsyncIgnore returns="23 24"/>
<!--
Upstreams have an optional attribute, "delayCheck", which is an ISO 8601 duration type.
https://en.wikipedia.org/wiki/ISO_8601#Durations
e.g. 5 minutes would be P0Y0M0DT0H5M0S or just PT5M.
It is used to determine if your upstream is "out of date" (e.g. will be skipped if its last check date is older
than the specified amount of time). Obviously this is only checked if you have a specified lastRemoteUpdate value.
-->
<!--
You can optionally specify an offset via the "offset" attribute in the same format as "delayCheck" if your
upstream's remote files are using a different timezone instead of UTC.
e.g.:
* If your upstream uses UTC-4 for its timestamp files, you would use "-PT4H".
* If your upstream uses UTC+6 for its timestamp files, you would use either "+PT6H" or just "PT6H".
-->
<upstream delayCheck="P0Y0M2DT0H0M0S" offset="-PT0S">
<!--
The following example uses "rsync://arch.mirror.constant.com/archlinux/"
(https://www.archlinux.org/mirrors/constant.com/1008/)
If you need to find a mirror, you may be interested in the utils/find_fastest_upstream/ scripts. They will
automatically find (and sort based on connection speed) all mirrors in your country for a given distro.
They can even generate stubbed configuration files using those upstreams.
Currently only Arch Linux and CentOS are supported.
-->
<!--
Required; one of:
* rsync
* ftp
-->
<syncType>rsync</syncType>
<!--
Required; ONLY the domain (or IP) goes here.
-->
<domain>arch.mirror.constant.com</domain>
<!--
Optional; if not specified,the protocol's default port will be used.
-->
<port>873</port>
<!--
Required; the *remote* path part of the URI. The leading / is necessary. A trailing one will be assumed.
-->
<path>/archlinux/</path>
</upstream>
<!--
Multiple upstreams can be specified. They are tried in order specified and if connection fails or times out,
the next one will be tried until no more specified upstreams exist.
-->
<upstream>
<syncType>rsync</syncType>
<domain>arch.mirror.square-r00t.net</domain>
<path>/arch/</path>
</upstream>
<upstream>
<!--
Only passive (PASV) mode for FTP is supported.
-->
<syncType>ftp</syncType>
<domain>sub.domain.tld</domain>
<port>21</port>
<path>/distros/archlinux/</path>
</upstream>
</distro>
<distro name="centos">
<upstream>
<syncType>rsync</syncType>
<domain>mirrors.rit.edu</domain>
<path>/centos/</path>
</upstream>
<dest>/srv/repos/centos/.</dest>
<lastLocalCheck timeFormat="MICROSECOND_EPOCH">/srv/repos/centos/CHECKED</lastLocalCheck>
<lastLocalSync timeFormat="UNIX_EPOCH">/srv/repos/centos/TIME</lastLocalSync>
<lastRemoteUpdate timeFormat="%a %d %b %H:%M:%S UTC %Y">/timestamp.txt</lastRemoteUpdate>
<lastRemoteSync timeFormat="UNIX_EPOCH">/TIME</lastRemoteSync>
<mountCheck>/</mountCheck>
</distro>
</mirror>