An open API service indexing awesome lists of open source software.

https://github.com/behnam0x/debian-mirror-sync

Bash script for interactive and customizable Debian mirror synchronization using debmirror. Supports multiple distros, suites, and section filtering with lockfile handling and logging.
https://github.com/behnam0x/debian-mirror-sync

automation bash bookworm bullseye buster debian debmirror forky linux mirrored-repository offline-repos sid stretch trixie

Last synced: about 1 month ago
JSON representation

Bash script for interactive and customizable Debian mirror synchronization using debmirror. Supports multiple distros, suites, and section filtering with lockfile handling and logging.

Awesome Lists containing this project

README

          

# ๐ŸŒ€ Debian Mirror Sync Script

A powerful and interactive Bash script for syncing Debian repositories using `debmirror`. It supports multiple distributions, optional suites, section filtering, custom mirrors, and robust lockfile handling โ€” all with detailed logging and colorful terminal output.

---

## ๐Ÿš€ Features

- Interactive or automated modes:
- `--all`: sync all supported distros
- `--manual`: specify a custom mirror URL and codename
- Supports syncing:
- Base distributions: `stretch`, `buster`, `bullseye`, `bookworm`, `trixie`, `forky`, `sid`
- Optional suites: `-security`, `-updates`, `-backports`
- Section filtering:
- Choose from `main`, `main,contrib`, or `main,contrib,non-free`
- Custom mirror URL support for alternative sources
- Lockfile detection and cleanup to prevent conflicts
- Excludes large desktop environments and multimedia packages to save space
- Logs activity to `/var/log/debmirror-update.log`
- Color-coded terminal output for better readability

---

## ๐Ÿ“ฆ Requirements

Ensure the following dependencies are installed:

- **Bash** (tested on Debian-based systems)
- **debmirror**
```bash
sudo apt install debmirror
```
- Standard utilities:
- `rsync`, `curl`, `awk`, `pgrep`, `tee`, `du`

---

## ๐Ÿงช Usage

Make the script executable:
```bash
chmod +x debian-mirror-sync.sh
```

Run interactively:
```bash
sudo ./debian-mirror-sync.sh
```

Or use automation flags:
```bash
sudo ./debian-mirror-sync.sh --all
sudo ./debian-mirror-sync.sh --manual
```

Follow the prompts to select distros, suites, and sections.

---

## ๐Ÿ’พ Disk Space Requirements

Estimated disk usage:

- **Single distro (main only)**: ~50โ€“80 GB
- **Full mirror (all distros + suites + sections)**: **500โ€“1000 GB+**

Actual usage depends on selections and exclusions.

---

## ๐ŸŒ Serving the Mirror

To use the mirrored packages on other machines:

1. Transfer the mirror directory to a server:
```bash
rsync -a /Debian-Repository/ user@server:/srv/apt-mirror/
```

2. Serve it via HTTP (e.g., using Nginx or Apache)

3. Add this to client machines:
```bash
echo "deb [trusted=yes] http://your-server/apt-mirror bullseye main contrib non-free" | sudo tee /etc/apt/sources.list.d/offline.list
sudo apt update
```

---

## ๐Ÿ“œ License

This project is licensed under the [MIT License](LICENSE). Feel free to modify and share.