Skip to content

Commit

Permalink
Update the EFI loader from the package installation script.
Browse files Browse the repository at this point in the history
The simply action of installation the script will perform the loader update.
  • Loading branch information
loos-br committed Nov 15, 2022
1 parent b197217 commit ce1cf18
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tools/templates/core_pkg/boot/metadir/+INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

if [ "${2}" != "POST-INSTALL" ]; then
exit 0
fi

if [ ! -f ${PKG_ROOTDIR}/boot/loader.efi ]; then
echo "EFI loader not found"
exit 1
fi

if [ ! -d ${PKG_ROOTDIR}/boot/efi ]; then
mkdir -p ${PKG_ROOTDIR}/boot/efi
fi

arch=$(uname -p)
LOADER_UPDATE=1
if [ -c ${PKG_ROOTDIR}/dev/msdosfs/EFISYS ]; then
mount_msdosfs ${PKG_ROOTDIR}/dev/msdosfs/EFISYS ${PKG_ROOTDIR}/boot/efi
elif [ -c ${PKG_ROOTDIR}/dev/gpt/EFISYS ]; then
mount_msdosfs ${PKG_ROOTDIR}/dev/gpt/EFISYS ${PKG_ROOTDIR}/boot/efi
else
unset LOADER_UPDATE
fi
if [ -n "${LOADER_UPDATE}" ]; then
_echo "Updating the EFI loader"
if [ "${arch}" = "aarch64" ]; then
cp ${PKG_ROOTDIR}/boot/loader.efi ${PKG_ROOTDIR}/boot/efi/efi/boot/BOOTaa64.efi
elif [ "${arch}" = "amd64" ]; then
cp ${PKG_ROOTDIR}/boot/loader.efi ${PKG_ROOTDIR}/boot/efi/efi/boot/BOOTx64.efi
fi
umount ${PKG_ROOTDIR}/boot/efi
fi

0 comments on commit ce1cf18

Please sign in to comment.