Skip to content

Instantly share code, notes, and snippets.

@sebastiaanfranken
Created August 26, 2017 21:27
Show Gist options
  • Save sebastiaanfranken/1ab2eca41c3b1630f1b1d0c814267791 to your computer and use it in GitHub Desktop.
Save sebastiaanfranken/1ab2eca41c3b1630f1b1d0c814267791 to your computer and use it in GitHub Desktop.
Update Fedora bootctl code, for (U)EFI booting
#!/bin/bash
# Version 0.2 by Sebastiaan Franken
# This is meant and tested on Fedora and Fedora only, with systemd-boot (bootctl)
# Place this file in /etc/kernel/postinst.d/ and don't forget to make it executable
# with chmod +x /etc/kernel/postinst.d/bootctl-postinst.sh
#
# Also, don't forget to modify the rootpath variable to reflect your situation
[ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel
rootpath="/dev/mapper/fedora_sebastiaan--zenbook-root"
version="$1"
configfile="/boot/efi/loader/entries/fedora.conf"
cat << EOF > ${configfile}
title Fedora ${version}
linux /vmlinuz
initrd /initramfs.img
options root=${rootpath} rhgb quiet LANG=nl_NL.UTF-8
EOF
cp /boot/vmlinuz-${version} /boot/efi/vmlinuz
cp /boot/initramfs-${version}.img /boot/efi/initramfs.img
bootctl --path=/boot/efi update >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment