cachyos secure boot setup (for limine bootloader)
0
cachy-limine-sb-setup.sh
1#!/bin/bash
2set -euo pipefail
3
4echo "LittleBit's CachyOS Secure Boot Setup"
5echo "Based on the guide from CachyOS: https://wiki.cachyos.org/configuration/secure_boot_setup/"
6echo
7echo "Make sure your Secure Boot keys are cleared in the BIOS before continuing."
8echo "ONLY USE THIS TOOL IF YOU ARE USING THE LIMINE BOOTLOADER!"
9echo
10echo "This tool requires root, you may be asked for your password by sudo."
11echo
12
13while true; do
14 read -p "Do you want to proceed? (y/n) " yn
15 case $yn in
16 [Yy]* ) echo "Proceeding..."; break;;
17 [Nn]* ) echo "Aborting."; exit;;
18 * ) echo "Please answer yes or no.";;
19 esac
20done
21
22# Install sbctl (Fixed missing package name)
23sudo pacman -S --needed sbctl
24
25# Setup Mode check
26echo "Checking Secure Boot status..."
27sudo sbctl status
28
29echo
30echo "Read the above command's output."
31echo 'To continue, the above command must read "Setup Mode: Enabled".'
32echo "Continuing with Setup Mode disabled will result in an error!"
33echo
34
35while true; do
36 read -p "Is Setup Mode enabled? (y/n) " yn
37 case $yn in
38 [Yy]* ) echo "Proceeding..."; break;;
39 [Nn]* ) echo "Aborting. Reboot and go to BIOS setup, and look for the option to clear Secure Boot keys."; exit;;
40 * ) echo "Please answer yes or no.";;
41 esac
42done
43
44# Generate owner key
45sudo sbctl create-keys
46
47# Enroll the owner keys alongside Microsoft and OEM keys
48sudo sbctl enroll-keys --microsoft --firmware-builtin
49
50# Final status check
51sudo sbctl status
52
53# Set up Limine
54echo "Signing Limine configuration..."
55sudo limine-enroll-config
56sudo limine-update
57
58echo
59echo "Setup complete! Please reboot to finalize Secure Boot enrollment."