# vim: syn=sh ft=sh et sw=2 sts=2 ts=2 tw=0:
#Packager: Cyrille Pontvieux <jrd~at~enialis~dot~net>

pkgname=lf-efi-preloader
pkgver=2013.02.08
pkgrel=1cp
arch=x86_64
source=(http://blog.hansenpartnership.com/wp-uploads/2013/HashTool.efi http://blog.hansenpartnership.com/wp-uploads/2013/KeyTool.efi http://blog.hansenpartnership.com/wp-uploads/2013/PreLoader.efi https://svn.code.sf.net/p/edk2/code/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi)
sourcetemplate=http://people.salixos.org/jrd/salix/$pkgname/$pkgver-\$arch-$pkgrel/
docs=("readme")
url=http://blog.hansenpartnership.com/linux-foundation-secure-boot-system-released/
options=('nosrcpack' 'nostrip')

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (Linux Foundation EFI PreLoader)"
"This is a set of files for EFI applications, developed by the Linux"
"Foundation, to be used with a UEFI+SecureBoot configuration."
"This contains PreLoader.efi, HashTool.efi, KeyTool.efi and a"
"EFI shell."
"SecureBoot is only available on x86_64, so same for this package."
)

build() {
  cd $SRC
  mkdir -p $PKG/boot/
  for f in HashTool KeyTool PreLoader Shell; do
    cp -v $f.efi $PKG/boot/
  done
  cat <<EOF > README
PreLoader.efi and HashTool.efi are signed by Microsoft.
KeyTool.efi and Shell.efi are not.
You should put PreLoader.efi as /EFI/Boot/bootx64.efi
and HashTool.efi in /EFI/Boot/
You can put KeyTool.efi and Shell.efi wherever you want,
but it's convenient to put them in /EFI/Boot/ too.
Your actual EFI boot loader/manager should be renamed as
  /EFI/Boot/loader.efi
On first boot, you will be asked to enroll the key for it.
After that, it will boot it directly.

For more, information:
- http://blog.hansenpartnership.com
- http://www.linuxfoundation.org/news-media/blogs/browse/2012/10/linux-foundation-uefi-secure-boot-system-open-source
- http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#Secure_boot
EOF
}