build() { ( echo '#!/bin/sh' echo 'exec tail -n +3 "$0"' # print everything verbatim on line 3 and below echo "set superusers=\"${grub_superuser}\"" echo -n "password_pbkdf2 ${grub_superuser} " grub-mkpasswd-pbkdf2 < <(echo "$grub_password"; echo "$grub_password") | \ sed -nE 's/PBKDF2 hash of your password is (.*)/\1/p' ) > "${srcdir}"/50_password # this horrible thing doesn't set the exit code correctly, always creates # the output file and also prints errors to stdout, so we'll have to do some # equally as horrible trickery to detect errors and still print the log while read -r line; do echo "$line" if [[ "$line" =~ error ]]; then die 'failed to convert boot menu font' fi done < <(grub-mkfont -s 30 -o "${srcdir}"/FreeMonoBold.pf2 "${srcdir}"/freefont-20120503/FreeMonoBold.ttf) }