dev: automated commit - 2025-06-08 23:28:55

This commit is contained in:
Mariano Z. 2025-06-08 23:28:56 -03:00
parent 33106ea4a6
commit 0ab9f62ace
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
13 changed files with 1255 additions and 715 deletions

View file

@ -1,37 +1,40 @@
#!/usr/bin/env bash
# NAME: Configure systemd-boot manager settings
# REQUIRES: sudo
set -euo pipefail
SDBOOT_CONFIG="/etc/sdboot-manage.conf"
echo "Configuring systemd-boot manager..."
# Check if sdboot-manage is installed
if ! command -v sdboot-manage &>/dev/null; then
echo "⚠️ sdboot-manage not found. Install systemd-boot-manager first."
# Source common functions
source "$(dirname "$0")/../common.sh" || {
echo "[ERROR] Could not source common.sh" >&2
exit 1
fi
}
# Backup existing config if it exists
if [[ -f "$SDBOOT_CONFIG" ]]; then
sudo cp "$SDBOOT_CONFIG" "$SDBOOT_CONFIG.backup.$(date +%Y%m%d_%H%M%S)"
echo "→ Backed up existing config"
fi
readonly SDBOOT_CONFIG="/etc/sdboot-manage.conf"
# Create the configuration
sudo tee "$SDBOOT_CONFIG" >/dev/null <<'EOF'
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"
#LINUX_FALLBACK_OPTIONS=""
# When DISABLE_FALLBACK is set to "yes", it will stop creating fallback entries for each kernel.
DISABLE_FALLBACK="no"
# Use this pattern to match kernels which should be considered native OS kernels
#KERNEL_PATTERN="vmlinuz-"
# Setting REMOVE_EXISTING to "yes" will remove all your existing systemd-boot entries before building new entries
REMOVE_EXISTING="yes"
@ -41,19 +44,18 @@ 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"
# If PRESERVE_FOREIGN is set to "yes", do not delete entries starting with $ENTRY_ROOT
#PRESERVE_FOREIGN="no"
# 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
#NO_AUTOUPDATE="no"
# Setting NO_AUTOGEN to "yes" will stop the automatic creation of entries when kernels are installed or updated
#NO_AUTOGEN="no"
# Use this to change the default initramfs prefix (e.g. when using booster)
#INITRD_PREFIX="initramfs"
# Additional entities to initrd can be added here, such as microcode if your initramfs does not include it.
#INITRD_ENTRIES=()
EOF
log_info "systemd-boot configuration updated"
}
main() {
init_script
check_requirements
configure_systemd_boot
finish_script 0
}
main "$@"