Skip to content

docs: fix apt mirror restore commands to match by path - #1993

Open
tangzz-radxa wants to merge 1 commit into
radxa-docs:mainfrom
tangzz-radxa:fix/apt-repo-restore-path-based
Open

docs: fix apt mirror restore commands to match by path#1993
tangzz-radxa wants to merge 1 commit into
radxa-docs:mainfrom
tangzz-radxa:fix/apt-repo-restore-path-based

Conversation

@tangzz-radxa

Copy link
Copy Markdown
Contributor

Summary

Fixes the "Restore Defaults" instructions in the Radxa OS apt repository mirror docs (_apt-repo.mdx, zh-CN + en).

Problem

The restore block used two sequential domain-only sed replacements per mirror, e.g.:

sudo sed -i 's/mirrors.cqu.edu.cn/deb.debian.org/g' /etc/apt/sources.list.d/*
sudo sed -i 's/mirrors.cqu.edu.cn/deb.ubuntu.com/g' /etc/apt/sources.list.d/*

The first command rewrites every occurrence of the mirror host — including Ubuntu source paths — to deb.debian.org, so the second command never sees mirrors.cqu.edu.cn again. On an Ubuntu system, restoring defaults yields broken entries like deb.debian.org/ubuntu instead of deb.ubuntu.com/ubuntu.

This was originally flagged by Copilot review on #1781 (comments on both the en and zh files), but #1781 was merged with the issue still present in main.

Fix

Match by path instead of host only, so each distribution is restored to its own default host:

sudo sed -i 's|mirrors.cqu.edu.cn/debian|deb.debian.org/debian|g' /etc/apt/sources.list.d/*
sudo sed -i 's|mirrors.cqu.edu.cn/ubuntu|deb.ubuntu.com/ubuntu|g' /etc/apt/sources.list.d/*

Applied to all affected mirror blocks (ustc, tuna, cqu) in both docs/common/radxa-os/_apt-repo.mdx and the en counterpart.

Test / verification

  • Bilingual guard: en + zh both updated, no missing counterparts.
  • The path-based pattern is consistent with the enable commands (host-only swap preserves the /debian vs /ubuntu path).

The restore-defaults block used two sequential domain-only sed
replacements per mirror (e.g. 's/mirrors.cqu.edu.cn/deb.debian.org/g'
then 's/mirrors.cqu.edu.cn/deb.ubuntu.com/g'). The first command
rewrites every occurrence of the mirror host, including Ubuntu source
paths, so the second command never matches and Ubuntu users end up with
broken 'deb.debian.org/ubuntu' entries. Match by path (/debian vs
/ubuntu) instead, which preserves the original default host for each
distribution. Applies to ustc, tuna, and cqu mirror blocks in both
zh-CN and en docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant