feat: add auto secure boot to new kernel update

This commit is contained in:
2026-07-28 13:16:02 +02:00
parent 61e0e1e840
commit 937fced108
9 changed files with 436 additions and 9 deletions

View File

@ -22,6 +22,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
info "Vérification des dépendances…"
deps=(python python-gobject gtk4 libadwaita pacman-contrib)
# Active l'intégration Secure Boot si une paire de clés MOK existe déjà.
secure_boot_configured=false
if [[ -r /root/secureboot-mok/MOK.key && -r /root/secureboot-mok/MOK.crt ]]; then
secure_boot_configured=true
deps+=(grub shim-signed sbsigntools)
fi
missing=()
for dep in "${deps[@]}"; do
if ! pacman -Qi "$dep" &>/dev/null; then
@ -47,6 +54,19 @@ install -m 755 "$SCRIPT_DIR"/bin/cachyos-updater /usr/bin/cachyos-updater
install -m 755 "$SCRIPT_DIR"/bin/cachyos-updater-ui /usr/bin/cachyos-updater-ui
install -m 755 "$SCRIPT_DIR"/bin/cachyos-updater-shutdown /usr/bin/cachyos-updater-shutdown
if $secure_boot_configured; then
install -d /usr/local/sbin /etc/pacman.d/hooks
install -m 750 \
"$SCRIPT_DIR"/secureboot/secureboot-sign-cachyos \
/usr/local/sbin/secureboot-sign-cachyos
install -m 644 \
"$SCRIPT_DIR"/secureboot/99-secureboot-sign-cachyos.hook \
/etc/pacman.d/hooks/99-secureboot-sign-cachyos.hook
info "Intégration Secure Boot installée"
else
warn "Clés MOK absentes : intégration Secure Boot non installée"
fi
# Unités systemd
install -m 644 "$SCRIPT_DIR"/systemd/cachyos-updater.service \
/usr/lib/systemd/system/cachyos-updater.service
@ -77,8 +97,10 @@ systemctl daemon-reload
systemctl enable --now cachyos-updater.timer
info "Timer activé : vérification au démarrage puis toutes les heures"
# Activer le service de shutdown (installation avant extinction)
systemctl enable cachyos-updater-shutdown.service
# Récrée les liens pour migrer les anciennes installations qui ciblaient
# directement poweroff.target/reboot.target, puis arme ExecStop.
systemctl reenable --now cachyos-updater-shutdown.service
systemctl start cachyos-updater-shutdown.service
info "Service shutdown activé : installation des mises à jour reportées à l'extinction"
# ── Résumé ─────────────────────────────────────────────────────────────────