diff --git a/mkimage.sh b/mkimage.sh index bfab9da..5fe2ee5 100755 --- a/mkimage.sh +++ b/mkimage.sh @@ -172,10 +172,10 @@ if [[ $USE_EFISHELL ]]; then [[ -e "${SOURCE}"/efi/startup.nsh ]] && cp "${SOURCE}"/efi/startup.nsh "$MY_TMPDIR"/boot/ [[ -e "${SOURCE}"/efi/LockDown.efi ]] && cp "${SOURCE}"/efi/LockDown.efi "$MY_TMPDIR"/boot/ cp "${SOURCE}"/efi/Shell.efi "$MY_TMPDIR"/boot/EFI/Boot/bootx64.efi - cp "$SOURCE"/bootx64.efi "$MY_TMPDIR"/boot/EFI/FedoraBook/1.efi + cp "$SOURCE"/efi/EFI/Boot/bootx64.efi "$MY_TMPDIR"/boot/EFI/FedoraBook/1.efi else - cp "$SOURCE"/bootx64.efi "$MY_TMPDIR"/boot/EFI/Boot/bootx64.efi - cp "$SOURCE"/bootx64.efi "$MY_TMPDIR"/boot/EFI/FedoraBook/1.efi + cp "$SOURCE"/efi/EFI/Boot/bootx64.efi "$MY_TMPDIR"/boot/EFI/Boot/bootx64.efi + cp "$SOURCE"/efi/EFI/Boot/bootx64.efi "$MY_TMPDIR"/boot/EFI/FedoraBook/1.efi fi umount "$MY_TMPDIR"/boot diff --git a/prepare-root.sh b/prepare-root.sh index b5dde04..504c213 100755 --- a/prepare-root.sh +++ b/prepare-root.sh @@ -805,6 +805,8 @@ echo -n "lockdown=1 quiet rd.shell=0 video=efifb:nobgrt "\ "verity.imagesize=$IMAGE_SIZE verity.roothash=$ROOT_HASH verity.root=PARTUUID=$ROOT_UUID " \ "verity.hashoffset=$ROOT_SIZE raid=noautodetect root=/dev/mapper/root" > "$MY_TMPDIR"/options.txt +mkdir -p "$MY_TMPDIR"/efi/EFI/FedoraBook + echo -n "${NAME}-${VERSION_ID}" > "$MY_TMPDIR"/release.txt objcopy \ --add-section .release="$MY_TMPDIR"/release.txt --change-section-vma .release=0x20000 \ @@ -812,12 +814,11 @@ objcopy \ ${LOGO:+--add-section .splash="$LOGO" --change-section-vma .splash=0x40000} \ --add-section .linux="$MY_TMPDIR"/linux --change-section-vma .linux=0x2000000 \ --add-section .initrd="$MY_TMPDIR"/initrd --change-section-vma .initrd=0x3000000 \ - "${BASEDIR}"/linuxx64.efi.stub "$MY_TMPDIR"/bootx64.efi + "${BASEDIR}"/linuxx64.efi.stub "$MY_TMPDIR"/efi/EFI/${NAME}/bootx64.efi mkdir -p "$OUTDIR" mv "$MY_TMPDIR"/root-hash.txt \ - "$MY_TMPDIR"/bootx64.efi \ "$MY_TMPDIR"/root.img \ "$MY_TMPDIR"/release.txt \ "$MY_TMPDIR"/options.txt \ @@ -829,7 +830,7 @@ mv "$MY_TMPDIR"/root-hash.txt \ for i in LockDown.efi Shell.efi startup.nsh; do [[ -e "${BASEDIR}"/$i ]] || continue - cp "$i" "$OUTDIR"/efi + cp "$i" "$OUTDIR"/efi/EFI/${NAME}/ done chown -R "$USER" "$OUTDIR" diff --git a/update.sh b/update.sh index 01d8760..1d3ded7 100755 --- a/update.sh +++ b/update.sh @@ -210,14 +210,23 @@ ROOT_UUID=${ROOT_HASH:32:8}-${ROOT_HASH:40:4}-${ROOT_HASH:44:4}-${ROOT_HASH:48:4 sfdisk --part-uuid ${ROOT_DEV} ${NEW_ROOT_PARTNO} ${ROOT_UUID} # install to /efi -mkdir -p /efi/EFI/${NAME} -cp bootx64.efi /efi/EFI/${NAME}/${NEW_ROOT_NUM}.efi - -if [[ -d efi ]]; then - cp -vr efi/* /efi/ +if [[ -d efi/EFI ]]; then + cp -vr efi/EFI/* /efi/EFI/ +fi + +if [[ ! -f /efi/EFI/Boot/bootx64.efi ]] \ + || cmp --quiet /efi/EFI/${NAME}/${OLD_ROOT_NUM}.efi /efi/EFI/Boot/bootx64.efi \ + || cmp --quiet /efi/EFI/${NAME}/_${OLD_ROOT_NUM}.efi /efi/EFI/Boot/bootx64.efi +then + cp /efi/EFI/${NAME}/bootx64.efi /efi/EFI/Boot/bootx64.efi +fi + +cp /efi/EFI/${NAME}/bootx64.efi /efi/EFI/${NAME}/${NEW_ROOT_NUM}.efi + +if [[ -f /efi/EFI/${NAME}/${OLD_ROOT_NUM}.efi ]]; then + mv /efi/EFI/${NAME}/${OLD_ROOT_NUM}.efi /efi/EFI/${NAME}/_${OLD_ROOT_NUM}.efi fi -mv /efi/EFI/${NAME}/${OLD_ROOT_NUM}.efi /efi/EFI/${NAME}/_${OLD_ROOT_NUM}.efi || : rm -f /efi/EFI/${NAME}/_${NEW_ROOT_NUM}.efi BOOT_ORDER=$(efibootmgr | grep BootOrder: | { read _ a; echo "$a"; })