Add pre-refresh-pacman.d hooks for custom repository support (#5681)
Fires after the channel template is copied to /etc/pacman.conf and before `pacman -Syyuu` runs, letting users layer custom Pacman repositories or IgnorePkg directives onto the freshly-written config so they're respected by the upgrade. Useful for users running on overlay distros (CachyOS, Chaotic-AUR, internal company repos) where a wipe-and-reinstall would otherwise pull vanilla Arch versions. Ships with `pre-refresh-pacman.d/add-custom-repo.sample` showing the pattern. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
324c9a4054
commit
c4dbf12920
@@ -19,5 +19,8 @@ echo
|
||||
sudo cp -f "$OMARCHY_PATH/default/pacman/pacman-$channel.conf" /etc/pacman.conf
|
||||
sudo cp -f "$OMARCHY_PATH/default/pacman/mirrorlist-$channel" /etc/pacman.d/mirrorlist
|
||||
|
||||
# Allow user customization of /etc/pacman.conf before the upgrade runs
|
||||
omarchy-hook pre-refresh-pacman
|
||||
|
||||
# Reset all package DBs and then update
|
||||
sudo pacman -Syyuu --noconfirm
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This hook is called by `omarchy refresh pacman` AFTER the channel template
|
||||
# is copied to /etc/pacman.conf and BEFORE `pacman -Syyuu` runs. Use it to
|
||||
# layer customizations onto the freshly-written pacman.conf so they're
|
||||
# respected by the upgrade — common cases are adding a custom repository
|
||||
# (e.g. CachyOS, Chaotic-AUR, an internal company repo) or extra IgnorePkg
|
||||
# lines.
|
||||
#
|
||||
# The hook runs as the invoking user with a warm sudo cache.
|
||||
#
|
||||
# To put it into use, remove .sample from this file name.
|
||||
|
||||
# Example: add an Include line above [core] for a custom repo.
|
||||
# Maintain the repo entries in /etc/pacman.d/custom-repos.conf yourself.
|
||||
|
||||
CONF=/etc/pacman.conf
|
||||
SNIPPET=/etc/pacman.d/custom-repos.conf
|
||||
MARKER="Include = $SNIPPET"
|
||||
|
||||
[[ -r $SNIPPET ]] || exit 0
|
||||
grep -qxF "$MARKER" "$CONF" && exit 0
|
||||
|
||||
sudo sed -i "0,/^\[core\]/s||$MARKER\n\n[core]|" "$CONF"
|
||||
Reference in New Issue
Block a user