# NAME

write-debian-select-list - write a list of nearby good Debian mirrors to a file

# SYNOPSIS

**write-debian-select-list** _DEST\_FILE_ _NUMBER\_MIRRORS_

# DESCRIPTION

**write-debian-select-list** is a thin wrapper around
**select-debian-mirror**(1) that writes a freshly-selected list of
Debian mirror hostnames to _DEST\_FILE_, suitable for consumption by
**debmirror**(1). The file begins with a single comment line recording
the date the list was generated, followed by _NUMBER\_MIRRORS_
hostnames, one per line.

The list is built in a temporary file and moved into place only after
**select-debian-mirror** succeeds, so _DEST\_FILE_ is never left in a
half-written state on failure. If _DEST\_FILE_ already exists, it is
unconditionally replaced.

The **rsync** protocol is requested unconditionally because **debmirror**
uses rsync as its transport.

# ARGUMENTS

- _DEST\_FILE_

    Path to the file that will receive the mirror list. Any existing file
    at this path is replaced atomically on success. Required.

- _NUMBER\_MIRRORS_

    Number of mirror hostnames to write. Must be a positive integer (1 or
    greater). Passed through to **select-debian-mirror --n-top-sites**.
    Required.

# EXIT STATUS

- **0**

    The list was written successfully.

- **1**

    **select-debian-mirror** failed (for example: the mirror-master site
    was unreachable, or no mirror passed the score cutoff).

- **2**

    Invalid command-line arguments: wrong number of arguments,
    _NUMBER\_MIRRORS_ was not a positive integer, or the directory
    component of _DEST\_FILE_ does not exist.

# EXAMPLES

Write 5 mirrors to the default debmirror location:

    $ write-debian-select-list /var/lib/debmirror/good-debian-mirrors 5

# SEE ALSO

**select-debian-mirror**(1), **debmirror**(1)

# AUTHOR

Adam H. Lewenberg <adamhl@stanford.edu> with some Claude Code assistance.
