add skript to updateEfiStubs
This commit is contained in:
parent
427e606aa2
commit
ad71cde364
2 changed files with 65 additions and 0 deletions
|
@ -138,8 +138,17 @@ if [[ $(qlist -I gentoo-sources) != "" ]] ; then
|
|||
myemerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||
fi
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
if [[ -n "$(which restart-services)" && $CHROOTED == "1" ]] ; then
|
||||
restart-services -l
|
||||
=======
|
||||
if [[ -n "$(which updateEfiStubsAndBootManager.sh)" && $CHROOTED == "1" ]] ; then
|
||||
updateEfiStubsAndBootManager.sh
|
||||
fi
|
||||
|
||||
if [[ -n "$(which restart_services)" && $CHROOTED == "1" ]] ; then
|
||||
restart_services -l
|
||||
>>>>>>> Stashed changes
|
||||
fi
|
||||
echo "Started at $STARTDATE"
|
||||
echo " Ended at $(date -Iseconds)"
|
||||
|
|
56
updateEfiStubsAndBootManager.sh
Executable file
56
updateEfiStubsAndBootManager.sh
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
EFIPART="/boot"
|
||||
STUBSFOLDER="/"
|
||||
EFISTUBSLOC="$EFIPART/$STUBSFOLDER"
|
||||
ORIGIN="/boot"
|
||||
efidevice="$(findmnt -n -o SOURCE --target "$EFISTUBSLOC")"
|
||||
|
||||
rootuuid=$(blkid -o value -s UUID "$(findmnt -n -o SOURCE --target "/")")
|
||||
|
||||
cmdbase="ro quiet rd.luks.allow-discards rd.luks.uuid="af0f0b72-7895-4ce0-bfe4-967024fe3948" root=UUID=$rootuuid"
|
||||
|
||||
function getDevice() {
|
||||
local device="$1"
|
||||
echo /dev/nvme0n1
|
||||
}
|
||||
|
||||
function getPartNumber() {
|
||||
echo 1
|
||||
}
|
||||
|
||||
function toWinPath() {
|
||||
echo $1 |sed -e "s,^/\+,,g" | sed -e "s,/,\\\\\\\\,g"
|
||||
}
|
||||
|
||||
function findInitramfs() {
|
||||
local ver="$1"
|
||||
if [[ -f "$EFIPART/initramfs-$ver.img" ]] ; then
|
||||
echo initramfs-$ver.img
|
||||
else
|
||||
echo initramfs
|
||||
fi
|
||||
}
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
#if [[ ! "$(realpath "$ORIGIN")" == "$(realpath "$EFISTUBSLOC")" ]] ; then
|
||||
# for image in /boot/vmlinuz* ; do
|
||||
# if strings "$image" | grep -qi "EFI stub" ; then
|
||||
# mv "$image" "$EFISTUBSLOC/"
|
||||
# fi
|
||||
# done
|
||||
#fi
|
||||
echo
|
||||
for image in "$EFISTUBSLOC"/vmlinuz* ; do
|
||||
if echo "$image" | grep -q old || ! strings "$image" | grep -qi "EFI stub" ; then
|
||||
continue
|
||||
fi
|
||||
IFS='-' read base version <<< "$(basename "$image" | sed -e "s/\.efi//")"
|
||||
# version="${SPLIT[@]:1:5}"
|
||||
echo $version
|
||||
imagepath="$STUBSFOLDER/$(basename $image)"
|
||||
if ! efibootmgr | grep -q "$version" ; then
|
||||
efibootmgr -d "$(getDevice "$efidevice")" -p $(getPartNumber "$efidevice") --create --label "Gentoo Kernel $version" --loader "$(toWinPath "$imagepath")" -u "$cmdbase initrd=$(findInitramfs $version)"
|
||||
fi
|
||||
done
|
Loading…
Add table
Reference in a new issue