Teki is a command-line tool for mirroring Debian and Ubuntu package repositories that supports both traditional apt-mirror style configurations and modern YAML formats, with features like concurrent downloads, resumable transfers, and selective mirror processing by index or range.
Find a file
2026-03-24 03:47:06 -07:00
cmd/teki feat: force download of release files in mirror processing 2026-03-24 03:47:06 -07:00
internal feat: add GPG signature verification support 2026-03-23 05:59:33 -07:00
logging refactor: remove progress bar implementation from logging package 2026-02-27 14:33:49 -08:00
testdata chore: add debian release test data files 2026-03-23 06:00:07 -07:00
vendor chore: add vendor files for gopkg.in/yaml.v3 dependency 2026-03-02 01:00:00 -08:00
.gitignore chore: remove teki from gitignore 2026-03-01 01:29:52 -08:00
go.mod feat: add YAML configuration support with auto-detection 2026-03-01 22:45:16 -08:00
go.sum chore: add gopkg.in/check.v1 and gopkg.in/yaml.v3 dependencies 2026-03-02 00:59:26 -08:00
README.md docs: add range notation documentation for mirror indices 2026-03-02 00:35:56 -08:00
TODO.md feat: add GPG signature verification support 2026-03-23 05:59:33 -07:00

Teki - Debian/Ubuntu Package Mirror Tool

Teki is a command-line tool for mirroring Debian and Ubuntu package repositories. It supports both traditional apt-mirror style configuration files and modern YAML configuration formats.

Installation

# Build from source
go build -o teki cmd/teki/main.go

# Or install directly
go install git.lan.thwap.org/thwap/tekisetsuna/cmd/teki@latest

Command Line Usage

teki -c <config-file> [options]

Options

Flag Short Description Default
--config -c Required. Path to configuration file
--verbose -v Enable verbose output false
--quiet -q Enable quiet mode (only errors) false
--list -l List mirrors with architecture and components false
--workers -w Number of download workers 10
--index -i Index of specific mirror to download (can be specified multiple times, supports ranges like 5-7)

Examples

# Process all mirrors in config file
teki -c teki.conf

# List available mirrors with their indices
teki -c teki.conf -l

# Download only specific mirrors (by index)
teki -c teki.conf -i 1 -i 3

# Download a range of mirrors
teki -c teki.conf -i 5-7

# Download multiple ranges and individual mirrors
teki -c teki.conf -i 1-3 -i 5 -i 8-10

# Use 20 download workers
teki -c teki.conf -w 20

# Enable verbose output
teki -c teki.conf -v

# Quiet mode (only errors)
teki -c teki.conf -q

Notes

  • -v/--verbose and -q/--quiet are mutually exclusive
  • -l/--list and -i/--index are mutually exclusive
  • Mirror indices start from 1 (not 0)
  • When using -i/--index, you can specify multiple indices to process only those mirrors
  • Range notation is supported (e.g., -i 5-7 for mirrors #5, #6, and #7)
  • Mirrors are always sorted by URL, ensuring consistent indices across runs

Range Support for Mirror Indices

The -i/--index flag supports range notation for selecting multiple consecutive mirrors:

  • Single index: -i 5 (downloads mirror #5)
  • Range: -i 5-7 (downloads mirrors #5, #6, and #7)
  • Multiple ranges: -i 1-3 -i 5-7 (downloads mirrors #1, #2, #3, #5, #6, #7)
  • Mixed: -i 1-3 -i 5 -i 8-10 (downloads mirrors #1, #2, #3, #5, #8, #9, #10)

Important Notes:

  • Ranges are inclusive (e.g., 5-7 includes 5, 6, and 7)
  • Range start must be less than or equal to end (e.g., 7-5 is invalid)
  • Indices start from 1 (not 0)
  • Duplicate indices are automatically removed
  • Mirrors are always sorted by URL, so indices remain stable between runs

Configuration File Formats

Teki supports two configuration file formats:

options:
  nthreads: 10
  base_path: /path/to/mirrors

http://pkgs.lan.thwap.org/debian:
  - codenames: [bullseye, bullseye-updates]
    architectures: [amd64, armhf, arm64]
    components: [main, contrib, non-free]
  - codenames: [bookworm, bookworm-updates]
    architectures: [amd64, armhf, arm64, riscv64]
    components: [main, contrib, non-free]
  - codenames: [trixie, trixie-updates]
    architectures: [amd64, armhf, arm64, riscv64]
    components: [main, contrib, non-free]

YAML Format Fields:

  • options: Global settings
    • nthreads: Number of download workers (overrides CLI -w flag)
    • base_path: Base directory for storing mirrored packages
  • Mirror URL as key: The repository URL
    • codenames: List of Debian/Ubuntu release names
    • architectures: List of CPU architectures to mirror
    • components: List of repository components

2. apt-mirror Style Configuration

# Global settings
set base_path    /mnt/mirror/debian
set nthreads     20

# Mirror entries
deb-amd64 http://ftp2.de.debian.org/debian/ buster main
deb-amd64 http://security.debian.org/debian-security buster/updates main
deb-arm64 http://ftp2.de.debian.org/debian/ stretch main
deb-src http://depo.pardus.org.tr/guvenlik ondokuz/updates main non-free contrib

apt-mirror Format Directives:

  • set base_path <path>: Base directory for storing mirrored packages
  • set nthreads <number>: Number of download workers
  • Mirror entry format: type url distribution components...
    • type: deb, deb-src, deb-<arch>, or deb-src-<arch>
    • url: Repository URL
    • distribution: Release name (e.g., "buster", "bookworm")
    • components: Space-separated list of components

How Teki Works

  1. Configuration Parsing: Teki automatically detects whether your config file is YAML or apt-mirror format
  2. Release File Download: Downloads and parses the Release file for each mirror
  3. Package List Processing: Downloads package lists (Packages files) for specified architectures and components
  4. Concurrent Downloads: Uses worker pools to download packages concurrently
  5. Resumable Downloads: Supports resuming interrupted downloads
  6. Progress Display: Shows real-time progress with download statistics

Output Levels

  • Normal: Shows basic progress and completion messages
  • Verbose (-v): Shows detailed debug information including individual file downloads
  • Quiet (-q): Only shows error messages

Supported Architectures

Teki supports all common Debian/Ubuntu architectures including:

  • amd64 (x86_64)
  • arm64 (aarch64)
  • armhf (ARM hard float)
  • armel (ARM EABI)
  • i386 (x86)
  • ppc64el (PowerPC 64-bit little-endian)
  • riscv64 (RISC-V 64-bit)
  • s390x (IBM System z)

Compression Formats

Teki automatically tries different compression formats for package lists in this order:

  1. .xz (preferred)
  2. .gz
  3. .bz2
  4. Uncompressed

License

[Your license information here]