Drop the replaced kernel's generated module tree (D-114)
The Core initramfs is written into /usr/lib/modules/<version>/ but is not package payload, so pacman -R linux would leave a second kernel directory behind and the finalizer's single-kernel assumption would break. Record the module trees the replaced package installed and remove them with it.
This commit is contained in:
parent
2bb07ab911
commit
d1c924d653
1 changed files with 10 additions and 0 deletions
|
|
@ -69,7 +69,17 @@ arch-chroot "$stage" pacman -S --needed --noconfirm -- "${desktop_packages[@]}"
|
|||
core_replacements=()
|
||||
replace_core_package() {
|
||||
arch-chroot "$stage" pacman -Q "$2" > "/job/evidence/replacement-$1.txt"
|
||||
# A kernel's generated initramfs lives in its module directory but is not owned
|
||||
# by the package, so removing the package alone would leave a stale second
|
||||
# kernel behind and every later `basename /usr/lib/modules/*` would see two.
|
||||
# Record the module trees that the replaced package actually installed, then
|
||||
# drop them with the package; the layer adapter allows exactly that removal.
|
||||
mapfile -t replaced_trees < <(arch-chroot "$stage" pacman -Ql "$1" |
|
||||
awk '$2 ~ /^\/?usr\/lib\/modules\/[^/]+\/vmlinuz$/ {sub(/\/vmlinuz$/, "", $2); sub(/^\//, "", $2); print $2}')
|
||||
arch-chroot "$stage" pacman -R --noconfirm -- "$1" >> "/job/evidence/replacement-$1.txt" 2>&1
|
||||
for tree in ${replaced_trees[@]+"${replaced_trees[@]}"}; do
|
||||
rm -rf "$stage/$tree"
|
||||
done
|
||||
core_replacements+=("$1:$2")
|
||||
}
|
||||
@@PACKAGE_REPLACEMENTS@@
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue