Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions installation/backend/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
normal install.

### Fixed
- `cachyos`: **non-v3 CPUs keep compatible repositories after install.**
The target now enables the v3 core/extra rebuilds only when glibc reports
x86-64-v3 support; baseline x86-64 uses the generic `[cachyos]` repository.
- `bootloader`: **a CachyOS install autoboots the CachyOS kernel.**
`ryoku_limine_autoboot` pointed default_entry at the first kernel the menu listed
(stock `linux`), so a fresh CachyOS box booted the Arch kernel; it now prefers the
Expand Down
41 changes: 28 additions & 13 deletions installation/backend/lib/cachyos.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# Make the installed target a CachyOS system for future updates: add the CachyOS
# x86-64-v3 repositories above [core], allow x86_64_v3 packages, enable [multilib]
# for the 32-bit gaming/driver set (proton-cachyos, lib32-*), and trust the
# CachyOS key from the installed cachyos-keyring (offline, no keyserver). Mirrors
# system/extras/ryoku-pkg-cachyos, run once in the target chroot at install time.
# Make the installed target a CachyOS system for future updates: add CPU-compatible
# CachyOS repositories above [core], enable [multilib] for the 32-bit gaming/driver
# set (proton-cachyos, lib32-*), and trust the CachyOS key from the installed
# cachyos-keyring (offline, no keyserver).
#
# The install ITSELF pulls every package (including the CachyOS kernel + proton)
# from the baked [offline] repo (lib/offline.sh); this step only wires future
# `pacman -Syu` to CachyOS so the box stays a CachyOS box.

ryoku_cachyos_repo() {
local conf=/mnt/etc/pacman.conf
local conf=/mnt/etc/pacman.conf v3=0
if [[ -n ${RYOKU_DRYRUN:-} ]]; then
log "DRYRUN: allow x86_64_v3, enable [multilib], add [cachyos-v3]/[cachyos-core-v3]/[cachyos-extra-v3]/[cachyos] above [core], populate the cachyos keyring in the target"
log "DRYRUN: select CPU-compatible CachyOS repos, enable [multilib], populate the cachyos keyring in the target"
return 0
fi
[[ -f $conf ]] || { log 'cachyos: no %s in the target yet; skipping repo config' "$conf"; return 0; }
log "cachyos: configuring the CachyOS repositories in the target"
ryoku_cachyos_arch "$conf"
if LC_ALL=C /lib/ld-linux-x86-64.so.2 --help 2>/dev/null |
grep -qF 'x86-64-v3 (supported'; then
v3=1
ryoku_cachyos_arch "$conf"
fi
ryoku_cachyos_multilib "$conf"
ryoku_cachyos_repos "$conf"
ryoku_cachyos_repos "$conf" "$v3"
ryoku_cachyos_keyring
}

Expand Down Expand Up @@ -54,12 +57,24 @@ EOF
grep -qE '^\[multilib\]' "$conf" || log "cachyos: warning, could not enable [multilib] (lib32 updates will be unavailable)"
}

# add the CachyOS v3 repos above [core]: the -v3 rebuilds give the ISA-optimized
# userland, the generic [cachyos] carries the kernels/settings/proton. Include
# the installed cachyos mirrorlists. left out on a conf with no [core] anchor.
# add CPU-compatible CachyOS repos above [core]. Baseline x86-64 gets only
# [cachyos]; v3-capable CPUs keep the optimized core/extra rebuilds.
ryoku_cachyos_repos() {
local conf=$1
local conf=$1 v3=${2:-1}
grep -qE '^\[cachyos' "$conf" && { log "cachyos: repositories already present"; return 0; }
if [[ $v3 != 1 ]]; then
if grep -qE '^\[core\]' "$conf"; then
run sed -i "0,/^\[core\]/ s|^\[core\]|[cachyos]\nInclude = /etc/pacman.d/cachyos-mirrorlist\n\n[core]|" "$conf"
else
append_file "$conf" <<'EOF'

[cachyos]
Include = /etc/pacman.d/cachyos-mirrorlist
EOF
fi
grep -qE '^\[cachyos\]' "$conf" || log 'cachyos: warning, could not add the CachyOS repo to %s' "$conf"
return 0
fi
grep -qE '^\[core\]' "$conf" || { log 'cachyos: no [core] anchor in %s; appending the CachyOS repos' "$conf"; ryoku_cachyos_repos_append "$conf"; return 0; }
run sed -i "0,/^\[core\]/ s|^\[core\]|[cachyos-v3]\nInclude = /etc/pacman.d/cachyos-v3-mirrorlist\n\n[cachyos-core-v3]\nInclude = /etc/pacman.d/cachyos-v3-mirrorlist\n\n[cachyos-extra-v3]\nInclude = /etc/pacman.d/cachyos-v3-mirrorlist\n\n[cachyos]\nInclude = /etc/pacman.d/cachyos-mirrorlist\n\n[core]|" "$conf"
grep -qE '^\[cachyos-v3\]' "$conf" || log 'cachyos: warning, could not add the CachyOS repos to %s' "$conf"
Expand Down
28 changes: 28 additions & 0 deletions tests/install-offline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,32 @@ while IFS=: read -r file lineno _; do
fail "unguarded in-chroot call to $helper (a target whose baked desktop set predates it dies here): $file:$lineno"
done < <(grep -rnE '^[^#]*run arch-chroot /mnt ryoku-[a-z-]+' "$root/installation/backend/lib/" || true)

# ---- 7. CachyOS update repositories match the CPU ISA ------------------------
(
run() { "$@"; }
append_file() { cat >>"$1"; }
log() { :; }
# shellcheck source=/dev/null
source "$root/installation/backend/lib/cachyos.sh"

baseline="$tmp/cachyos-baseline.conf"
printf '[options]\nArchitecture = auto\n\n[core]\nInclude = /etc/pacman.d/mirrorlist\n' >"$baseline"
ryoku_cachyos_repos "$baseline" 0
headers=$(grep -oE '^\[[a-z0-9_-]+\]' "$baseline" | grep -v '^\[options\]$')
[[ $headers == $'[cachyos]\n[core]' ]] \
|| fail "baseline CachyOS repo order is '$headers'"
! grep -qF 'x86_64_v3' "$baseline" \
|| fail "baseline CachyOS config enabled x86_64_v3 packages"

v3="$tmp/cachyos-v3.conf"
printf '[options]\nArchitecture = auto\n\n[core]\nInclude = /etc/pacman.d/mirrorlist\n' >"$v3"
ryoku_cachyos_arch "$v3"
ryoku_cachyos_repos "$v3" 1
headers=$(grep -oE '^\[[a-z0-9_-]+\]' "$v3" | grep -v '^\[options\]$')
[[ $headers == $'[cachyos-v3]\n[cachyos-core-v3]\n[cachyos-extra-v3]\n[cachyos]\n[core]' ]] \
|| fail "v3 CachyOS repo order is '$headers'"
grep -qE '^Architecture[[:space:]]*=.*x86_64_v3' "$v3" \
|| fail "v3 CachyOS config did not enable x86_64_v3 packages"
)

echo "install-offline: OK"
Loading