#!/bin/bash -e
# Super Grub Disk - supergrub-mkstandalone
# Copyright (C) 2009,2010,2011,2012,2013,2014,2015 Adrian Gibanel Lopez.
#
# Super Grub Disk is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Super Grub Disk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Super Grub Disk. If not, see .
usage() {
cat <&2
grub-mkstandalone binary cannot be run.
Either you need to install it
either you need to build it from grub build scripts
Aborting.
EOF
exit 1
fi
if [ ! -x "$GRUB_MKFONT_BINARY" ] ; then
cat << EOF 1>&2
grub-mkfont binary cannot be run.
Either you need to install it
either you need to build it from grub build scripts
Aborting.
EOF
exit 2
fi
BOOT_ISOS_DIRECTORY="boot-isos"
overlay=$(mktemp -d)
ISO_FILENAME="supergrub2-${sgrub_version}-${CUSTOM_FORMAT}-STANDALONE.EFI"
if [[ "x$CUSTOM_ISO_FILENAME" != x ]] ; then
ISO_FILENAME="${CUSTOM_ISO_FILENAME}"
fi
default_options="--output=${ISO_FILENAME} /=${overlay}"
if [[ "x$CUSTOM_FORMAT" != x ]] ; then
default_options="-O ${CUSTOM_FORMAT} ${default_options}"
fi
init_overlay_dir
copy_boot_isos_directory
copy_copyright
generate_and_copy_mo_files
check_unifont
"${GRUB_MKSTANDALONE_BINARY}" $default_options
rm -r "$overlay"
generate_filename_hashes "${ISO_FILENAME}"