diff --git a/README.md b/README.md index bdcdf22..02b4f45 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,12 @@ with 1 GB RAM the sync is invisible in `free -h`. ### Installation ```bash -git clone gitea-github-mirror -cd gitea-github-mirror +git clone github-to-gitea-mirror +cd github-to-gitea-mirror ./install.sh ``` -`install.sh` copies the scripts to `~/gitea-github-mirror`, creates `mirror.env` +`install.sh` copies the scripts to `~/github-to-gitea-mirror`, creates `mirror.env` from the example, fixes permissions and adds the cron entry. It is safe to re-run — an existing `mirror.env` is never overwritten. @@ -57,7 +57,7 @@ docker exec -u git gitea admin user generate-access-token \ Then fill in `mirror.env` and verify: ```bash -cd ~/gitea-github-mirror +cd ~/github-to-gitea-mirror DRY_RUN=true python3 sync_mirrors.py # preview, changes nothing python3 sync_mirrors.py # run for real ``` @@ -150,7 +150,7 @@ python3 -m unittest discover -s tests -v ### Troubleshooting ```bash -tail -f ~/gitea-github-mirror/sync.log +tail -f ~/github-to-gitea-mirror/sync.log ``` | Log line | Cause | @@ -209,12 +209,12 @@ Raspberry Pi 3B mit 1 GB RAM ist der Sync in `free -h` nicht zu sehen. ### Installation ```bash -git clone gitea-github-mirror -cd gitea-github-mirror +git clone github-to-gitea-mirror +cd github-to-gitea-mirror ./install.sh ``` -`install.sh` kopiert die Skripte nach `~/gitea-github-mirror`, legt `mirror.env` +`install.sh` kopiert die Skripte nach `~/github-to-gitea-mirror`, legt `mirror.env` aus der Vorlage an, setzt die Rechte und trägt den Cron-Job ein. Mehrfaches Ausführen ist unbedenklich — eine vorhandene `mirror.env` wird nie überschrieben. @@ -234,7 +234,7 @@ docker exec -u git gitea admin user generate-access-token \ Danach `mirror.env` ausfüllen und prüfen: ```bash -cd ~/gitea-github-mirror +cd ~/github-to-gitea-mirror DRY_RUN=true python3 sync_mirrors.py # Vorschau, ändert nichts python3 sync_mirrors.py # echter Lauf ``` @@ -333,7 +333,7 @@ python3 -m unittest discover -s tests -v ### Fehlersuche ```bash -tail -f ~/gitea-github-mirror/sync.log +tail -f ~/github-to-gitea-mirror/sync.log ``` | Log-Zeile | Ursache | diff --git a/install.sh b/install.sh index 491241c..f996b7e 100644 --- a/install.sh +++ b/install.sh @@ -9,7 +9,7 @@ set -eu SRC="$(dirname "$(readlink -f "$0")")" -TARGET="${TARGET:-$HOME/gitea-github-mirror}" +TARGET="${TARGET:-$HOME/github-to-gitea-mirror}" CRON_TIME="${CRON_TIME:-30 4}" say() { printf '%s\n' "$*"; } diff --git a/sync_mirrors.py b/sync_mirrors.py index e2f49a3..a21abbd 100644 --- a/sync_mirrors.py +++ b/sync_mirrors.py @@ -95,7 +95,7 @@ def api(url, token=None, scheme="token", method="GET", payload=None): data = None headers = { "Accept": "application/json", - "User-Agent": "gitea-github-mirror/1.0", + "User-Agent": "github-to-gitea-mirror/1.0", } if payload is not None: data = json.dumps(payload).encode("utf-8") @@ -137,7 +137,7 @@ def download_github_asset(cfg, asset): """Download a release asset into a temporary file without buffering it in RAM.""" headers = { "Accept": "application/octet-stream", - "User-Agent": "gitea-github-mirror/1.0", + "User-Agent": "github-to-gitea-mirror/1.0", } if cfg["GITHUB_TOKEN"]: headers["Authorization"] = "Bearer %s" % cfg["GITHUB_TOKEN"] @@ -169,7 +169,7 @@ def upload_release_asset(cfg, repo_name, release_id, asset, source, size): % (cfg["GITEA_URL"], path_part(cfg["GITEA_OWNER"]), path_part(repo_name), release_id, query)) parsed = urllib.parse.urlsplit(url) - boundary = "----gitea-github-mirror-%s" % uuid.uuid4().hex + boundary = "----github-to-gitea-mirror-%s" % uuid.uuid4().hex safe_name = str(asset["name"]).replace("\\", "_").replace('"', "_") safe_name = safe_name.replace("\r", "_").replace("\n", "_") content_type = asset.get("content_type") or "application/octet-stream" @@ -195,7 +195,7 @@ def upload_release_asset(cfg, repo_name, release_id, asset, source, size): conn.putheader("Accept", "application/json") conn.putheader("Content-Type", "multipart/form-data; boundary=%s" % boundary) conn.putheader("Content-Length", str(len(preamble) + size + len(ending))) - conn.putheader("User-Agent", "gitea-github-mirror/1.0") + conn.putheader("User-Agent", "github-to-gitea-mirror/1.0") conn.endheaders() conn.send(preamble) while True: diff --git a/tests/__init__.py b/tests/__init__.py index 7918cc8..585fe16 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Tests for gitea-github-mirror.""" +"""Tests for github-to-gitea-mirror."""