Files
coredesktop/system/finish-install.sh
T
davidandClaude Opus 5.5 1e2581dcc5
shellcheck / shellcheck (push) Successful in 48s
Keep the running kernel's modules after a kernel upgrade
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>
2026-11-26 18:41:50 -07:00

57 lines
2.4 KiB
Bash

#!/bin/bash
#
# Purpose : The end of install.sh: say the install worked, say whether to
# reboot and offer to (not while the initramfs doesn't build),
# and offer configure if something is still to do. refresh
# runs install.sh too, so it may all be done already; the install
# still ends by saying it worked, so it can't be taken for a failure.
# install.sh is usually piped into bash, so ask on the terminal
TTY="${COREDESKTOP_TTY:-/dev/tty}"
CONFIGURE="$HOME/.local/bin/configure"
source "$(dirname "$0")/../utils.sh"
CONFIGURE_HINT="configure connects to your Federated Core, sets up backups and signs you in to the AI agents."
echo
echo -e "\e[32mCoreDesktop is installed.\e[0m"
# If a newer kernel was installed during this run, configure waits for the
# reboot: until then, the modules it needs (Tailscale's tun, davfs2's fuse) are
# at best kernel-modules-hook's temporary copy. The reboot waits for the
# initramfs to build.
if initramfs_build_failed; then
# check_initramfs (install.sh) has said why; offering a reboot now could
# leave the computer unable to start
echo -e "\e[31mDon't reboot yet: the initramfs doesn't build (see above, or $PACMAN_UPDATE_LOG).\e[0m"
if newer_kernel_installed; then
echo "Once it builds (sudo mkinitcpio -P), reboot, then run: configure"
echo "$CONFIGURE_HINT"
exit 0
fi
elif newer_kernel_installed; then
echo "A newer kernel has been installed. Reboot, then run: configure"
echo "$CONFIGURE_HINT"
# The same as the system menu's restart: an active desktop session needs no password
if { : < "$TTY"; } 2> /dev/null && read -rp "Reboot now? [y/N] " answer < "$TTY" \
&& [[ "$answer" == [yY]* ]]; then
echo "Rebooting..."
systemctl reboot || echo "Couldn't reboot. Restart from the system menu instead."
fi
exit 0
else
echo "Kernel is up to date, no reboot needed. You may want to consider a reboot if other significant software was updated or installed."
fi
if "$CONFIGURE" --list | grep -q '^to do'; then
echo
echo "$CONFIGURE_HINT"
if { : < "$TTY"; } 2> /dev/null && read -rp "Run configure now? [Y/n] " answer < "$TTY" \
&& [[ "$answer" != [nN]* ]]; then
# Straight to the terminal, outside the log: sign-ins need a terminal, and
# their codes and links don't belong in a log
"$CONFIGURE" < "$TTY" > "$TTY" 2>&1 || true
else
echo "To do it later, run: configure"
fi
fi