boot 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env bash
  2. # NAME: Configure systemd-boot manager settings
  3. set -euo pipefail
  4. SDBOOT_CONFIG="/etc/sdboot-manage.conf"
  5. echo "Configuring systemd-boot manager..."
  6. # Check if sdboot-manage is installed
  7. if ! command -v sdboot-manage &>/dev/null; then
  8. echo "⚠️ sdboot-manage not found. Install systemd-boot-manager first."
  9. exit 1
  10. fi
  11. # Backup existing config if it exists
  12. if [[ -f "$SDBOOT_CONFIG" ]]; then
  13. sudo cp "$SDBOOT_CONFIG" "$SDBOOT_CONFIG.backup.$(date +%Y%m%d_%H%M%S)"
  14. echo "→ Backed up existing config"
  15. fi
  16. # Create the configuration
  17. sudo tee "$SDBOOT_CONFIG" >/dev/null <<'EOF'
  18. # Config file for sdboot-manage
  19. # Kernel options to be appended to the "options" line
  20. LINUX_OPTIONS="zswap.enabled=0 nowatchdog ipv6.disable=1 audit=0 loglevel=3 rd.systemd.show_status=auto rd.udev.log_level=3"
  21. #LINUX_FALLBACK_OPTIONS=""
  22. # When DISABLE_FALLBACK is set to "yes", it will stop creating fallback entries for each kernel.
  23. DISABLE_FALLBACK="no"
  24. # Use this pattern to match kernels which should be considered native OS kernels
  25. #KERNEL_PATTERN="vmlinuz-"
  26. # Setting REMOVE_EXISTING to "yes" will remove all your existing systemd-boot entries before building new entries
  27. REMOVE_EXISTING="yes"
  28. # Unless OVERWRITE_EXISTING is set to "yes" existing entries for currently installed kernels will not be touched
  29. # this setting has no meaning if REMOVE_EXISTING is set to "yes"
  30. OVERWRITE_EXISTING="yes"
  31. # When REMOVE_OBSOLETE is set to "yes" entries for kernels no longer available on the system will be removed
  32. REMOVE_OBSOLETE="yes"
  33. # If PRESERVE_FOREIGN is set to "yes", do not delete entries starting with $ENTRY_ROOT
  34. #PRESERVE_FOREIGN="no"
  35. # Setting NO_AUTOUPDATE to "yes" will stop the updates to systemd-boot when systemd is updated - not recommended unless you are seperately updating systemd-boot
  36. #NO_AUTOUPDATE="no"
  37. # Setting NO_AUTOGEN to "yes" will stop the automatic creation of entries when kernels are installed or updated
  38. #NO_AUTOGEN="no"
  39. # Use this to change the default initramfs prefix (e.g. when using booster)
  40. #INITRD_PREFIX="initramfs"
  41. # Additional entities to initrd can be added here, such as microcode if your initramfs does not include it.
  42. #INITRD_ENTRIES=()
  43. EOF