Keep the running kernel's modules after a kernel upgrade
shellcheck / shellcheck (push) Successful in 48s
shellcheck / shellcheck (push) Successful in 48s
install.sh failed whenever its upgrade replaced the kernel (Arch installed a few days earlier): pacman deletes the running kernel's modules, so Docker and then the firewall couldn't load theirs. The smoketest found it. kernel-modules-hook keeps them until the next reboot, and its cleanup service removes them after. install.sh installs it with archlinux-keyring, in a transaction of its own so its hooks run for the upgrade; packages.conf lists it and the service, so update adds them to existing machines. With the modules kept, a missing modules folder no longer means a newer kernel was installed, so newer_kernel_installed (utils.sh) also counts a folder no package owns, and the reboot check, version and finish-install use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
# updates.d/99-reboot-check.sh, with a fake /usr/lib/modules and pacman
|
||||
|
||||
setup() {
|
||||
common_setup
|
||||
mkdir -p "$HOME/.local/share"
|
||||
ln -s "$REPO" "$HOME/.local/share/coredesktop"
|
||||
export COREDESKTOP_MODULES_DIR="$BATS_TEST_TMPDIR/modules"
|
||||
RUNNING="$COREDESKTOP_MODULES_DIR/$(uname -r)"
|
||||
NEEDED="$HOME/.local/state/coredesktop/reboot-needed"
|
||||
# pacman -Qo: the running kernel's modules belong to linux, unless OWNED is empty
|
||||
export OWNED=linux
|
||||
stub pacman '[ "$1" = -Qqo ] && [ -n "$OWNED" ] && echo "$OWNED"'
|
||||
}
|
||||
|
||||
@test "reboot check: nothing to do when the running kernel's modules are the installed kernel's" {
|
||||
mkdir -p "$RUNNING"
|
||||
run bash "$REPO/updates.d/99-reboot-check.sh"
|
||||
[ "$status" -eq 0 ]
|
||||
[ ! -e "$NEEDED" ]
|
||||
}
|
||||
|
||||
@test "reboot check: a reboot is needed when the running kernel's modules are gone" {
|
||||
run bash "$REPO/updates.d/99-reboot-check.sh"
|
||||
[[ "$output" == *"Please reboot"*"a newer kernel was installed"* ]]
|
||||
[ "$(cat "$NEEDED")" = "a newer kernel was installed" ]
|
||||
}
|
||||
|
||||
@test "reboot check: a reboot is needed when they're only kernel-modules-hook's copy" {
|
||||
mkdir -p "$RUNNING"
|
||||
OWNED=""
|
||||
run bash "$REPO/updates.d/99-reboot-check.sh"
|
||||
[ "$(cat "$NEEDED")" = "a newer kernel was installed" ]
|
||||
}
|
||||
Reference in New Issue
Block a user