# Ubuntu PPA mirror (pkg.shecan.ir)

> Mirror of every public Launchpad PPA (ppa.launchpadcontent.net/<owner>/<ppa>/ubuntu) for apt on Ubuntu, with the PPA signing keys (keyserver.ubuntu.com) and the Launchpad API lookup of a PPA's key fingerprint.

- Upstream: ppa.launchpadcontent.net, keyserver.ubuntu.com
- Mirror URL: <https://mirror-ppa.pkg.shecan.ir/>
- Clients: apt
- Service status: <https://pkg.shecan.ir/status.json> (key `ppa`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/ppa/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/ppa.json>

## Limitations

- add-apt-repository talks to Launchpad and writes ppa.launchpadcontent.net into the sources; add the PPA with the commands of this guide, or point PPAs added earlier at the mirror.
- apt verifies the PPA's own signature; keys are served over HTTPS only.
- Private PPAs (private-ppa.launchpadcontent.net, with credentials) are not supported.

## 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)

Run, Add a PPA (Ubuntu 22.04 and newer); set PPA= to <owner>/<ppa> (linux)

```sh
PPA=deadsnakes/ppa
PPA_OWNER=${PPA%/*} PPA_NAME=${PPA#*/}
FPR=$(curl -fsS "https://mirror-ppa.pkg.shecan.ir/api/~$PPA_OWNER/+archive/ubuntu/$PPA_NAME" | grep -o '"signing_key_fingerprint": "[0-9A-F]*"' | grep -o '[0-9A-F]\{40\}')
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsS -o /etc/apt/keyrings/ppa-$PPA_OWNER-$PPA_NAME.asc "https://mirror-ppa.pkg.shecan.ir/keys/$FPR.asc"
CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME")
printf 'Types: deb\nURIs: https://mirror-ppa.pkg.shecan.ir/%s/ubuntu/\nSuites: %s\nComponents: main\nSigned-By: /etc/apt/keyrings/ppa-%s-%s.asc\n' "$PPA" "$CODENAME" "$PPA_OWNER" "$PPA_NAME" | sudo tee /etc/apt/sources.list.d/ppa-$PPA_OWNER-$PPA_NAME.sources
sudo apt update
```

Verify, Add a PPA (Ubuntu 22.04 and newer); set PPA= to <owner>/<ppa> (linux)

```sh
sudo apt install -y python3.13
```

Run, PPAs added earlier with add-apt-repository (linux)

```sh
sudo sed -i -E 's#https?://ppa\.launchpad(content)?\.net/#https://mirror-ppa.pkg.shecan.ir/#' $(grep -rlE 'ppa\.launchpad(content)?\.net' /etc/apt/sources.list.d)
sudo apt update
```

Undo / restore the default, Add a PPA (Ubuntu 22.04 and newer); set PPA= to <owner>/<ppa> (linux)

```sh
sudo rm /etc/apt/sources.list.d/ppa-deadsnakes-ppa.sources /etc/apt/keyrings/ppa-deadsnakes-ppa.asc
sudo apt update
```
