8-boot 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env bash
  2. # NAME: Configure systemd-boot manager settings
  3. # REQUIRES: sudo
  4. set -euo pipefail
  5. # Source common functions
  6. source "$(dirname "$0")/../common.sh" || {
  7. echo "[ERROR] Could not source common.sh" >&2
  8. exit 1
  9. }
  10. readonly SDBOOT_CONFIG="/etc/sdboot-manage.conf"
  11. check_requirements() {
  12. if ! command_exists sdboot-manage; then
  13. log_error "sdboot-manage not found. Install systemd-boot-manager first"
  14. exit 1
  15. fi
  16. }
  17. configure_systemd_boot() {
  18. log_info "Configuring systemd-boot manager"
  19. if [[ -f "$SDBOOT_CONFIG" ]]; then
  20. backup_file "$SDBOOT_CONFIG"
  21. fi
  22. log_info "Creating systemd-boot configuration"
  23. tee "$SDBOOT_CONFIG" >/dev/null <<'EOF'
  24. # Config file for sdboot-manage
  25. # Kernel options to be appended to the "options" line
  26. LINUX_OPTIONS="zswap.enabled=0 nowatchdog ipv6.disable=1 audit=0 loglevel=3 rd.systemd.show_status=auto rd.udev.log_level=3"
  27. # When DISABLE_FALLBACK is set to "yes", it will stop creating fallback entries for each kernel.
  28. DISABLE_FALLBACK="no"
  29. # Setting REMOVE_EXISTING to "yes" will remove all your existing systemd-boot entries before building new entries
  30. REMOVE_EXISTING="yes"
  31. # Unless OVERWRITE_EXISTING is set to "yes" existing entries for currently installed kernels will not be touched
  32. # this setting has no meaning if REMOVE_EXISTING is set to "yes"
  33. OVERWRITE_EXISTING="yes"
  34. # When REMOVE_OBSOLETE is set to "yes" entries for kernels no longer available on the system will be removed
  35. REMOVE_OBSOLETE="yes"
  36. EOF
  37. log_info "systemd-boot configuration updated"
  38. }
  39. main() {
  40. init_script
  41. check_requirements
  42. configure_systemd_boot
  43. finish_script 0
  44. }
  45. main "$@"