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.
- Go 100%
| cmd/teki | ||
| internal | ||
| logging | ||
| testdata | ||
| vendor | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
| TODO.md | ||
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/--verboseand-q/--quietare mutually exclusive-l/--listand-i/--indexare 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-7for 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-7includes 5, 6, and 7) - Range start must be less than or equal to end (e.g.,
7-5is 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:
1. YAML Configuration (Recommended)
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 settingsnthreads: Number of download workers (overrides CLI-wflag)base_path: Base directory for storing mirrored packages
- Mirror URL as key: The repository URL
codenames: List of Debian/Ubuntu release namesarchitectures: List of CPU architectures to mirrorcomponents: 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 packagesset nthreads <number>: Number of download workers- Mirror entry format:
type url distribution components...type:deb,deb-src,deb-<arch>, ordeb-src-<arch>url: Repository URLdistribution: Release name (e.g., "buster", "bookworm")components: Space-separated list of components
How Teki Works
- Configuration Parsing: Teki automatically detects whether your config file is YAML or apt-mirror format
- Release File Download: Downloads and parses the
Releasefile for each mirror - Package List Processing: Downloads package lists (Packages files) for specified architectures and components
- Concurrent Downloads: Uses worker pools to download packages concurrently
- Resumable Downloads: Supports resuming interrupted downloads
- 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:
.xz(preferred).gz.bz2- Uncompressed
License
[Your license information here]