dev/runs/boot

61 lines
1.6 KiB
Bash
Executable file

#!/usr/bin/env bash
# NAME: Configure systemd-boot manager settings
# REQUIRES: sudo
set -euo pipefail
# Source common functions
source "$(dirname "$0")/../common.sh" || {
echo "[ERROR] Could not source common.sh" >&2
exit 1
}
readonly SDBOOT_CONFIG="/etc/sdboot-manage.conf"
check_requirements() {
if ! command_exists sdboot-manage; then
log_error "sdboot-manage not found. Install systemd-boot-manager first"
exit 1
fi
}
configure_systemd_boot() {
log_info "Configuring systemd-boot manager"
if [[ -f "$SDBOOT_CONFIG" ]]; then
backup_file "$SDBOOT_CONFIG"
fi
log_info "Creating systemd-boot configuration"
tee "$SDBOOT_CONFIG" >/dev/null <<'EOF'
# Config file for sdboot-manage
# Kernel options to be appended to the "options" line
LINUX_OPTIONS="zswap.enabled=0 nowatchdog ipv6.disable=1 audit=0 loglevel=3 rd.systemd.show_status=auto rd.udev.log_level=3"
# When DISABLE_FALLBACK is set to "yes", it will stop creating fallback entries for each kernel.
DISABLE_FALLBACK="no"
# Setting REMOVE_EXISTING to "yes" will remove all your existing systemd-boot entries before building new entries
REMOVE_EXISTING="yes"
# Unless OVERWRITE_EXISTING is set to "yes" existing entries for currently installed kernels will not be touched
# this setting has no meaning if REMOVE_EXISTING is set to "yes"
OVERWRITE_EXISTING="yes"
# When REMOVE_OBSOLETE is set to "yes" entries for kernels no longer available on the system will be removed
REMOVE_OBSOLETE="yes"
EOF
log_info "systemd-boot configuration updated"
}
main() {
init_script
check_requirements
configure_systemd_boot
finish_script 0
}
main "$@"