Put the OmarchyCN [omarchy] mirror first on the stable channel
The Gitea mirror db is registry-signed, so installs trust the registry key right after the pacman.conf restore, and a cn migration does the same on existing systems with an idempotent exact-line guard. The insertion lives in cn/lib/mirror.sh so 'omarchycn doctor mirror --fix' can restore the line after omarchy-refresh-pacman resets an overlay system's conf. Only stable is mirrored: the Gitea repository name must equal the pacman section name, and edge/rc stay on upstream directly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019hLK3wsDuKVAC37GgDqg6H
This commit is contained in:
+26
-1
@@ -69,6 +69,27 @@ check_mirror() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# refresh-pacman restores the checkout's template, which on overlay installs
|
||||||
|
# has no OmarchyCN mirror line; this check makes that loss visible and fixable
|
||||||
|
check_omarchy_repo() {
|
||||||
|
local conf="${OMARCHYCN_PACMAN_CONF:-/etc/pacman.conf}"
|
||||||
|
|
||||||
|
if ! grep -q "^Server = https://pkgs.omarchy.org/stable/" "$conf"; then
|
||||||
|
echo "INFO omarchy-repo: 非 stable 通道,跳过 OmarchyCN 镜像检查"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if cn_mirror_omarchy_repo_ok; then
|
||||||
|
echo "PASS omarchy-repo: OmarchyCN 镜像行在位"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if [[ $fix == "true" ]] && cn_mirror_omarchy_repo_fix && cn_mirror_omarchy_repo_ok; then
|
||||||
|
echo "PASS omarchy-repo: 已重新插入 OmarchyCN 镜像行"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "FAIL omarchy-repo: [omarchy] 缺 OmarchyCN 镜像行(omarchycn doctor mirror --fix 可修复)"
|
||||||
|
failures=$((failures + 1))
|
||||||
|
}
|
||||||
|
|
||||||
check_dev_mirror() {
|
check_dev_mirror() {
|
||||||
omarchy-cn-dev-mirror-doctor || failures=$((failures + 1))
|
omarchy-cn-dev-mirror-doctor || failures=$((failures + 1))
|
||||||
}
|
}
|
||||||
@@ -79,12 +100,16 @@ check_ime() {
|
|||||||
|
|
||||||
case "$module" in
|
case "$module" in
|
||||||
network) check_network ;;
|
network) check_network ;;
|
||||||
mirror) check_mirror ;;
|
mirror)
|
||||||
|
check_mirror
|
||||||
|
check_omarchy_repo
|
||||||
|
;;
|
||||||
dev-mirror) check_dev_mirror ;;
|
dev-mirror) check_dev_mirror ;;
|
||||||
ime) check_ime ;;
|
ime) check_ime ;;
|
||||||
all)
|
all)
|
||||||
check_network
|
check_network
|
||||||
check_mirror
|
check_mirror
|
||||||
|
check_omarchy_repo
|
||||||
check_dev_mirror
|
check_dev_mirror
|
||||||
check_ime
|
check_ime
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -4,6 +4,19 @@
|
|||||||
CN_MIRRORS_JSON="$OMARCHY_PATH/cn/mirrors.json"
|
CN_MIRRORS_JSON="$OMARCHY_PATH/cn/mirrors.json"
|
||||||
CN_MIRRORLIST="/etc/pacman.d/mirrorlist"
|
CN_MIRRORLIST="/etc/pacman.d/mirrorlist"
|
||||||
CN_PROFILE_FILE="$HOME/.config/omarchycn/mirror-profile"
|
CN_PROFILE_FILE="$HOME/.config/omarchycn/mirror-profile"
|
||||||
|
CN_OMARCHY_MIRROR="https://git.zacharyzhang.com/api/packages/ZacharyZhang-NY/arch/omarchy/x86_64"
|
||||||
|
|
||||||
|
# [omarchy] mirror line management (stable channel only); shared by the
|
||||||
|
# rollout migration and doctor --fix so refresh-pacman resets stay healable
|
||||||
|
cn_mirror_omarchy_repo_ok() {
|
||||||
|
grep -qxF "Server = $CN_OMARCHY_MIRROR" "${OMARCHYCN_PACMAN_CONF:-/etc/pacman.conf}"
|
||||||
|
}
|
||||||
|
|
||||||
|
cn_mirror_omarchy_repo_fix() {
|
||||||
|
local conf="${OMARCHYCN_PACMAN_CONF:-/etc/pacman.conf}"
|
||||||
|
cn_mirror_omarchy_repo_ok && return 0
|
||||||
|
sudo sed -i "s|^Server = https://pkgs.omarchy.org/stable/|Server = $CN_OMARCHY_MIRROR\nServer = https://pkgs.omarchy.org/stable/|" "$conf"
|
||||||
|
}
|
||||||
|
|
||||||
cn_mirror_ids() {
|
cn_mirror_ids() {
|
||||||
jq -r '.mirrors[].id' "$CN_MIRRORS_JSON"
|
jq -r '.mirrors[].id' "$CN_MIRRORS_JSON"
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
echo "Trust the OmarchyCN registry key and put the [omarchy] mirror first"
|
||||||
|
|
||||||
|
sudo pacman-key --add "$OMARCHY_PATH/cn/keys/omarchycn-registry.asc"
|
||||||
|
sudo pacman-key --lsign-key 74DCF57ACD812B24D959F146BD386048867B33B4
|
||||||
|
|
||||||
|
# Only the stable channel is mirrored; edge/rc systems keep upstream directly
|
||||||
|
source "$OMARCHY_PATH/cn/lib/mirror.sh"
|
||||||
|
cn_mirror_omarchy_repo_fix
|
||||||
@@ -27,4 +27,6 @@ Include = /etc/pacman.d/mirrorlist
|
|||||||
|
|
||||||
[omarchy]
|
[omarchy]
|
||||||
SigLevel = Optional TrustAll
|
SigLevel = Optional TrustAll
|
||||||
|
# OmarchyCN mirror first (registry-signed db, key via cn/keys), upstream fallback
|
||||||
|
Server = https://git.zacharyzhang.com/api/packages/ZacharyZhang-NY/arch/omarchy/x86_64
|
||||||
Server = https://pkgs.omarchy.org/stable/$arch
|
Server = https://pkgs.omarchy.org/stable/$arch
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
cp -f "$OMARCHY_PATH/default/pacman/pacman-${OMARCHY_MIRROR:-stable}.conf" /etc/pacman.conf
|
cp -f "$OMARCHY_PATH/default/pacman/pacman-${OMARCHY_MIRROR:-stable}.conf" /etc/pacman.conf
|
||||||
cp -f "$OMARCHY_PATH/default/pacman/mirrorlist-${OMARCHY_MIRROR:-stable}" /etc/pacman.d/mirrorlist
|
cp -f "$OMARCHY_PATH/default/pacman/mirrorlist-${OMARCHY_MIRROR:-stable}" /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
# The [omarchy] mirror db is signed by the OmarchyCN registry key
|
||||||
|
pacman-key --add "$OMARCHY_PATH/cn/keys/omarchycn-registry.asc"
|
||||||
|
pacman-key --lsign-key 74DCF57ACD812B24D959F146BD386048867B33B4
|
||||||
|
|
||||||
# omarchy-settings skips this override until cups-browsed is actually present
|
# omarchy-settings skips this override until cups-browsed is actually present
|
||||||
# to avoid pacman creating cups-browsed.conf.pacnew during ISO package install.
|
# to avoid pacman creating cups-browsed.conf.pacnew during ISO package install.
|
||||||
if [[ -f $OMARCHY_PATH/etc-overrides/cups-cups-browsed.conf && -d /etc/cups ]]; then
|
if [[ -f $OMARCHY_PATH/etc-overrides/cups-cups-browsed.conf && -d /etc/cups ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user