# Raspberry Pi OS mirror (pkg.shecan.ir)

> Mirror of the Raspberry Pi OS repositories for apt: archive.raspberrypi.com/debian (Raspberry Pi packages, 32- and 64-bit) and raspbian.raspberrypi.com/raspbian (the 32-bit armhf distribution). The Debian part of 64-bit Raspberry Pi OS uses the Debian mirror.

- Upstream: archive.raspberrypi.com, raspbian.raspberrypi.com
- Mirror URLs: <https://mirror-raspberrypi.pkg.shecan.ir/debian/>, <https://mirror-raspberrypi.pkg.shecan.ir/raspbian/>
- Clients: apt
- Service status: <https://pkg.shecan.ir/status.json> (key `raspberrypi`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/raspberrypi/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/raspberrypi.json>

## Limitations

- apt still verifies the official Raspberry Pi and Raspbian signatures.
- Plain HTTP is enabled like on the official hosts; switch to https after installing ca-certificates if you prefer.
- Raspbian packages are served from full Raspbian mirrors (RWTH Aachen, then Aliyun) because raspbian.raspberrypi.com redirects every package to a mirror; the signed index still comes from raspbian.raspberrypi.com.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### apt: persistent (user- or system-wide configuration)

Back up first (linux)

```sh
sudo mkdir -p /root/apt-sources.bak && sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.d /root/apt-sources.bak/
```

Run (linux)

```sh
sudo sed -i -E 's#https?://archive\.raspberrypi\.(com|org)/debian#http://mirror-raspberrypi.pkg.shecan.ir/debian#; s#https?://raspbian\.raspberrypi\.(com|org)/raspbian#http://mirror-raspberrypi.pkg.shecan.ir/raspbian#; s#https?://(deb|security)\.debian\.org/#http://mirror-debian.pkg.shecan.ir/#' $(grep -rlE 'raspberrypi\.(com|org)|debian\.org' /etc/apt/sources.list /etc/apt/sources.list.d 2>/dev/null)
```

Run (linux)

```sh
sudo apt update
```

Undo / restore the default (linux)

```sh
sudo cp -a /root/apt-sources.bak/sources.list /root/apt-sources.bak/sources.list.d /etc/apt/
```
