Align the China region to the official cn profile

The region value is cn, the China files live under default/regions/cn/, and
omarchy-apply-pacman renders pacman for every caller: the .cn twins of the
channel servers first, then .org, USTC and ArchLinuxCN. Switching to China
installs and trusts the ArchLinuxCN keyring. A migration renames china to cn
and repoints the drop-in links.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 11:33:01 -04:00
1 parent d2e4a95aed
commit 9a57690e7d
20 files changed
+119 -99

No files matched your search

+5 -4
View File
@@ -32,18 +32,19 @@ for channel in stable rc edge; do
edge) host=mirror.omarchy.org ;;
esac
apply "$channel"
expected=$(printf 'Server = https://%s/$repo/os/$arch\nServer = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' "$host")
expected=$(printf 'Server = https://%s/$repo/os/$arch\nServer = https://%s/$repo/os/$arch\nServer = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' "${host%.org}.cn" "$host")
[[ $(<"$TARGET_ROOT/etc/pacman.d/mirrorlist") == "$expected" ]] || fail "$channel mirror order and variables"
{
cat "$ROOT/default/pacman/pacman-$channel.conf"
sed -f "$ROOT/default/regions/cn/pacman/servers.sed" "$ROOT/default/pacman/pacman-$channel.conf"
printf '\n[archlinuxcn]\nServer = https://mirrors.ustc.edu.cn/archlinuxcn/$arch\n'
} > "$scratch/expected.conf"
grep -qx "Server = https://pkgs.omarchy.cn/$channel/\$arch" "$scratch/expected.conf" || fail "$channel lists the .cn Omarchy repository"
cmp "$scratch/expected.conf" "$TARGET_ROOT/etc/pacman.conf"
apply "$channel"
cmp "$TARGET_ROOT/etc/pacman.conf.bak" "$TARGET_ROOT/etc/pacman.conf"
cmp "$TARGET_ROOT/etc/pacman.d/mirrorlist.bak" "$TARGET_ROOT/etc/pacman.d/mirrorlist"
done
pass "China keeps each channel first, appends only CN defaults, and is idempotent"
pass "China puts a .cn twin ahead of each channel server, appends the CN defaults, and is idempotent"
cp "$TARGET_ROOT/etc/pacman.conf" "$scratch/before.conf"
cp "$TARGET_ROOT/etc/pacman.d/mirrorlist" "$scratch/before.mirrors"
@@ -75,7 +76,7 @@ mkdir -p "$scratch/rendered"
"$ROOT/bin/omarchy-apply-pacman" --render rc "$scratch/rendered" "$TARGET_ROOT"
rg -qxF 'Server = https://pkgs.omarchy.org/rc/$arch' "$scratch/rendered/pacman.conf"
rg -qxF '[archlinuxcn]' "$scratch/rendered/pacman.conf"
[[ $(<"$scratch/rendered/mirrorlist") == $'Server = https://rc-mirror.omarchy.org/$repo/os/$arch\nServer = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' ]] ||
[[ $(<"$scratch/rendered/mirrorlist") == $'Server = https://rc-mirror.omarchy.cn/$repo/os/$arch\nServer = https://rc-mirror.omarchy.org/$repo/os/$arch\nServer = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch' ]] ||
fail "render keeps the channel mirror first"
cmp "$scratch/before.conf" "$TARGET_ROOT/etc/pacman.conf"
pass "render builds the regional channel files without touching the target"