2023-09-30 12:46:03 +00:00
|
|
|
#! /usr/bin/env bash
|
2023-11-15 11:04:59 +00:00
|
|
|
[ "${2}" ] || exit 1
|
2023-09-30 12:46:03 +00:00
|
|
|
FILE="$(realpath "${BASH_SOURCE[0]}")"
|
2023-11-15 11:04:59 +00:00
|
|
|
SCRIPT="$(basename "${FILE}")"
|
|
|
|
ROOT="$(dirname "${FILE}")"
|
|
|
|
PROJECT="$(basename "${ROOT}")"
|
|
|
|
|
|
|
|
PGP_PUB="${1}"
|
|
|
|
ESP_ROOT="${2}"
|
|
|
|
DATA_ROOT="${3}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
function get_path_mount {
|
|
|
|
stat --format '%m' "${1}"
|
|
|
|
}
|
|
|
|
function get_mount_uuid {
|
|
|
|
findmnt --noheadings --output 'UUID' "${1}"
|
|
|
|
}
|
|
|
|
function get_path_uuid {
|
2023-11-15 11:04:59 +00:00
|
|
|
local tmp="$(get_path_mount "${1}/")"
|
2023-09-30 12:46:03 +00:00
|
|
|
get_mount_uuid "${tmp}"
|
|
|
|
}
|
2023-11-15 11:04:59 +00:00
|
|
|
ESP="$(get_path_uuid "${ESP_ROOT}")"
|
|
|
|
if [ "${DATA_ROOT}" ] ; then
|
|
|
|
DATA="$(get_path_uuid "${DATA_ROOT}")"
|
2023-10-01 19:14:31 +00:00
|
|
|
else
|
|
|
|
DATA="${ESP}"
|
|
|
|
fi
|
2023-09-30 12:46:03 +00:00
|
|
|
|
2023-11-08 08:24:45 +00:00
|
|
|
function sign {
|
|
|
|
if [ -d "${1}" ] ; then
|
|
|
|
local file
|
|
|
|
local files
|
|
|
|
readarray -t files <<< "$(find "${1}" -type f | sort)"
|
2023-11-11 15:36:57 +00:00
|
|
|
echo
|
|
|
|
echo "${1}"
|
2023-11-08 08:24:45 +00:00
|
|
|
for file in "${files[@]}" ; do
|
2023-11-11 15:36:57 +00:00
|
|
|
sign "${file}" "${1}"
|
2023-11-08 08:24:45 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
if [ -f "${1}" ] ; then
|
2023-11-11 15:36:57 +00:00
|
|
|
if [ "${2}" ] ; then
|
|
|
|
echo "$(realpath --relative-to "${2}" "${1}")"
|
|
|
|
else
|
|
|
|
echo "${1}"
|
|
|
|
fi
|
2023-11-08 08:24:45 +00:00
|
|
|
gpg \
|
|
|
|
--quiet \
|
|
|
|
--default-key "${PGP_PUB}!" \
|
|
|
|
--detach-sign \
|
|
|
|
"${1}"
|
|
|
|
fi
|
|
|
|
}
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# imports ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-15 11:04:59 +00:00
|
|
|
source "${ROOT}/${SCRIPT%.*}.mod"
|
|
|
|
|
|
|
|
# constants ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
|
|
|
BIOS_BOOT='/usr/lib/grub/i386-pc/boot.img'
|
|
|
|
COMPRESSION='xz'
|
|
|
|
GRUB_HEAD='# GRUB Environment Block'
|
|
|
|
SIGNED_GRUB='/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed'
|
|
|
|
SIGNED_SHIM='/usr/lib/shim/shimx64.efi.signed'
|
2023-12-15 21:51:27 +00:00
|
|
|
SIGNED_ARM_GRUB='/usr/lib/grub/arm64-efi-signed/grubaa64.efi.signed'
|
2023-12-15 20:40:54 +00:00
|
|
|
ARM_SHIM='/usr/lib/shim/shimaa64.efi.signed'
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# variables ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-15 11:04:59 +00:00
|
|
|
MEMDISK_ROOT="${ESP_ROOT}/memdisk"
|
2023-11-21 08:13:18 +00:00
|
|
|
MEMDISK_DIRECTORY="${MEMDISK_ROOT}/grub"
|
2023-09-30 12:46:03 +00:00
|
|
|
MEMDISK_FILE="${MEMDISK_DIRECTORY}/grub.cfg"
|
2023-11-21 08:13:18 +00:00
|
|
|
MEMDISK_FONTS="${MEMDISK_DIRECTORY}/fonts"
|
|
|
|
MEMDISK_ARCHIVE="${MEMDISK_ROOT}/grub.tar"
|
2023-11-15 11:04:59 +00:00
|
|
|
|
|
|
|
UEFI_ROOT="${ESP_ROOT}/efi"
|
2023-09-30 12:46:03 +00:00
|
|
|
UEFI_DIRECTORY="${UEFI_ROOT}/boot"
|
2023-12-15 21:51:27 +00:00
|
|
|
UEFI_CORE="${UEFI_DIRECTORY}/corex64.efi"
|
2023-09-30 12:46:03 +00:00
|
|
|
UEFI_FILE="${UEFI_DIRECTORY}/bootx64.efi"
|
2023-11-03 23:30:39 +00:00
|
|
|
UEFI_GRUB="${UEFI_DIRECTORY}/grubx64.efi"
|
2023-12-15 21:51:27 +00:00
|
|
|
ARM_CORE="${UEFI_DIRECTORY}/coreaa64.efi"
|
2023-12-15 20:40:54 +00:00
|
|
|
ARM_FILE="${UEFI_DIRECTORY}/bootaa64.efi"
|
|
|
|
ARM_GRUB="${UEFI_DIRECTORY}/grubaa64.efi"
|
2023-11-15 11:04:59 +00:00
|
|
|
|
|
|
|
BIOS_ROOT="${ESP_ROOT}/bios"
|
|
|
|
BIOS_FILE="${BIOS_ROOT}/core.img"
|
|
|
|
BIOS_SETUP="${BIOS_ROOT}/setup.sh"
|
|
|
|
|
|
|
|
BOOT_ROOT="${ESP_ROOT}/boot"
|
|
|
|
|
|
|
|
GRUB_CFG_SH="${ROOT}/grub.cfg.sh"
|
|
|
|
GRUB_SHIGNED="${ROOT}/grubx64.efi.signed.sh"
|
|
|
|
|
2023-11-11 15:36:57 +00:00
|
|
|
GRUB_ROOT="${BOOT_ROOT}/grub"
|
2023-11-03 23:30:39 +00:00
|
|
|
GRUB_CFG="${GRUB_ROOT}/grub.cfg"
|
2023-11-11 15:36:57 +00:00
|
|
|
GRUBENV="${GRUB_ROOT}/grubenv"
|
2023-11-13 15:59:24 +00:00
|
|
|
GRUB_FONTS="${GRUB_ROOT}/fonts"
|
|
|
|
GRUB_LOCALES="${GRUB_ROOT}/locale"
|
2023-11-10 19:09:15 +00:00
|
|
|
GRUB_PUB="${GRUB_ROOT}/grub.pgp"
|
2023-11-13 15:59:24 +00:00
|
|
|
GRUB_THEMES="${GRUB_ROOT}/themes"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
2023-11-15 11:04:59 +00:00
|
|
|
GRUB_ENV="${ESP_ROOT}/grub.env"
|
|
|
|
|
|
|
|
LIVE_ROOT="${BOOT_ROOT}/${PROJECT}"
|
|
|
|
|
2023-09-30 12:46:03 +00:00
|
|
|
# wipe ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
2023-11-15 11:04:59 +00:00
|
|
|
→ ${BOOT_ROOT}
|
2023-11-13 15:59:24 +00:00
|
|
|
→ ${MEMDISK_ROOT}
|
|
|
|
→ ${UEFI_ROOT}
|
2023-11-15 11:04:59 +00:00
|
|
|
→ ${BIOS_ROOT}
|
2023-11-13 15:59:24 +00:00
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
rm --force --recursive \
|
2023-11-15 11:04:59 +00:00
|
|
|
"${BOOT_ROOT}" "${MEMDISK_ROOT}" "${UEFI_ROOT}" "${BIOS_ROOT}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# memdisk ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
2023-11-21 08:13:18 +00:00
|
|
|
→ ${MEMDISK_FONTS}
|
2023-11-13 15:59:24 +00:00
|
|
|
"
|
2023-11-21 08:13:18 +00:00
|
|
|
mkdir --parents "${MEMDISK_FONTS}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${MEMDISK_FILE}
|
|
|
|
"
|
2023-11-21 08:13:18 +00:00
|
|
|
echo "\
|
2023-11-14 12:51:37 +00:00
|
|
|
echo \"prefix | \${prefix}\"
|
|
|
|
search --no-floppy --set root --fs-uuid '${ESP}'
|
|
|
|
prefix=\"(\${root})/boot/grub\"
|
|
|
|
echo \"prefix | \${prefix}\"
|
2023-09-30 12:46:03 +00:00
|
|
|
" > "${MEMDISK_FILE}"
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${GRUB_SHIGNED}
|
|
|
|
↘ ${MEMDISK_FILE}
|
|
|
|
"
|
2023-11-12 18:05:36 +00:00
|
|
|
cat "${GRUB_SHIGNED}" >> "${MEMDISK_FILE}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
2023-11-21 08:13:18 +00:00
|
|
|
↙ ${MEMDISK_DIRECTORY}
|
2023-11-13 15:59:24 +00:00
|
|
|
↘ ${MEMDISK_ARCHIVE}
|
|
|
|
"
|
2023-11-21 08:13:18 +00:00
|
|
|
cd "${MEMDISK_DIRECTORY}"
|
2023-09-30 12:46:03 +00:00
|
|
|
tar --create --auto-compress \
|
2023-11-21 08:13:18 +00:00
|
|
|
--file "${MEMDISK_ARCHIVE}" 'grub.cfg'
|
2023-11-15 11:04:59 +00:00
|
|
|
cd -
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# uefi ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${UEFI_DIRECTORY}
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
mkdir --parents "${UEFI_DIRECTORY}"
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${MEMDISK_ARCHIVE}
|
|
|
|
↘ ${UEFI_FILE}
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
grub-mkimage \
|
|
|
|
--compress "${COMPRESSION}" \
|
|
|
|
--memdisk "${MEMDISK_ARCHIVE}" \
|
|
|
|
--format 'x86_64-efi' \
|
|
|
|
--output "${UEFI_FILE}" \
|
2023-11-21 08:13:18 +00:00
|
|
|
--prefix '(memdisk)/' \
|
2023-09-30 12:46:03 +00:00
|
|
|
"${MODULES[@]}"
|
2023-12-15 21:03:32 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${MEMDISK_ARCHIVE}
|
|
|
|
↘ ${ARM_FILE}
|
|
|
|
"
|
|
|
|
grub-mkimage \
|
|
|
|
--compress "${COMPRESSION}" \
|
|
|
|
--memdisk "${MEMDISK_ARCHIVE}" \
|
|
|
|
--format 'arm64-efi' \
|
|
|
|
--output "${ARM_FILE}" \
|
|
|
|
--prefix '(memdisk)/' \
|
|
|
|
"${MODULES[@]}"
|
|
|
|
|
2023-11-03 23:30:39 +00:00
|
|
|
if [ -f "${SIGNED_SHIM}" ] ; then
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${UEFI_FILE}
|
|
|
|
↘ ${UEFI_GRUB}
|
|
|
|
"
|
2023-11-03 23:30:39 +00:00
|
|
|
mv "${UEFI_FILE}" "${UEFI_GRUB}"
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${SIGNED_SHIM}
|
|
|
|
↘ ${UEFI_FILE}
|
|
|
|
"
|
2023-11-03 23:30:39 +00:00
|
|
|
cp "${SIGNED_SHIM}" "${UEFI_FILE}"
|
|
|
|
fi
|
2023-12-15 21:28:30 +00:00
|
|
|
if [ -f "${ARM_SHIM}" ] ; then
|
|
|
|
echo -n "
|
|
|
|
↙ ${ARM_FILE}
|
|
|
|
↘ ${ARM_GRUB}
|
|
|
|
"
|
|
|
|
mv "${ARM_FILE}" "${ARM_GRUB}"
|
|
|
|
echo -n "
|
|
|
|
↙ ${ARM_SHIM}
|
|
|
|
↘ ${ARM_FILE}
|
|
|
|
"
|
|
|
|
cp "${ARM_SHIM}" "${ARM_FILE}"
|
|
|
|
fi
|
|
|
|
|
2023-11-03 23:30:39 +00:00
|
|
|
if [ -f "${SIGNED_GRUB}" ] ; then
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${UEFI_GRUB}
|
|
|
|
↘ ${UEFI_CORE}
|
|
|
|
"
|
|
|
|
mv "${UEFI_GRUB}" "${UEFI_CORE}"
|
|
|
|
echo -n "
|
|
|
|
↙ ${SIGNED_GRUB}
|
|
|
|
↘ ${UEFI_GRUB}
|
|
|
|
"
|
2023-11-03 23:30:39 +00:00
|
|
|
cp "${SIGNED_GRUB}" "${UEFI_GRUB}"
|
|
|
|
fi
|
2023-12-15 21:51:27 +00:00
|
|
|
if [ -f "${SIGNED_ARM_GRUB}" ] ; then
|
|
|
|
echo -n "
|
|
|
|
↙ ${ARM_GRUB}
|
|
|
|
↘ ${ARM_CORE}
|
|
|
|
"
|
|
|
|
mv "${ARM_GRUB}" "${ARM_CORE}"
|
|
|
|
echo -n "
|
|
|
|
↙ ${SIGNED_ARM_GRUB}
|
|
|
|
↘ ${ARM_GRUB}
|
|
|
|
"
|
2023-12-16 00:12:51 +00:00
|
|
|
cp "${SIGNED_ARM_GRUB}" "${ARM_GRUB}"
|
2023-12-15 21:51:27 +00:00
|
|
|
fi
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# bios ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
2023-11-15 11:04:59 +00:00
|
|
|
→ ${BIOS_ROOT}
|
2023-11-13 15:59:24 +00:00
|
|
|
"
|
2023-11-15 11:04:59 +00:00
|
|
|
mkdir "${BIOS_ROOT}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${BIOS_BOOT}
|
2023-11-15 11:04:59 +00:00
|
|
|
↘ ${BIOS_ROOT}
|
2023-11-13 15:59:24 +00:00
|
|
|
"
|
2023-11-15 11:04:59 +00:00
|
|
|
cp "${BIOS_BOOT}" "${BIOS_ROOT}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${MEMDISK_ARCHIVE}
|
|
|
|
↘ ${BIOS_FILE}
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
grub-mkimage \
|
|
|
|
--compress "${COMPRESSION}" \
|
|
|
|
--memdisk "${MEMDISK_ARCHIVE}" \
|
|
|
|
--format 'i386-pc' \
|
|
|
|
--output "${BIOS_FILE}" \
|
2023-11-21 08:13:18 +00:00
|
|
|
--prefix '(memdisk)/' \
|
2023-09-30 12:46:03 +00:00
|
|
|
"${MODULES[@]}" "${MODULES_BIOS[@]}"
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${BIOS_SETUP}
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
echo -n '#! /usr/bin/env bash
|
|
|
|
FILE="$(realpath "${BASH_SOURCE[0]}")"
|
|
|
|
DIRECTORY="$(dirname "${FILE}")"
|
|
|
|
|
|
|
|
/usr/lib/grub/i386-pc/grub-bios-setup \
|
|
|
|
--directory "${DIRECTORY}" \
|
|
|
|
"${1}"
|
|
|
|
' >> "${BIOS_SETUP}"
|
|
|
|
|
|
|
|
# grub ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${GRUB_ROOT}
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
mkdir --parents "${GRUB_ROOT}"
|
|
|
|
|
2023-11-03 23:30:39 +00:00
|
|
|
# grub / cfg ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${GRUB_CFG_SH}
|
|
|
|
↘ ${GRUB_CFG}
|
|
|
|
"
|
|
|
|
cp "${GRUB_CFG_SH}" "${GRUB_CFG}"
|
2023-11-03 23:30:39 +00:00
|
|
|
|
2023-09-30 12:46:03 +00:00
|
|
|
# grub / env ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-11 15:36:57 +00:00
|
|
|
function write_env {
|
|
|
|
local file="${1}"
|
|
|
|
local kv="${2}"
|
|
|
|
local text="${GRUB_HEAD}
|
|
|
|
${kv}"
|
|
|
|
while [ ${#text} -lt 1024 ] ; do
|
|
|
|
text="${text}#"
|
|
|
|
done
|
|
|
|
echo -n "${text}" > "${file}"
|
|
|
|
}
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${GRUBENV}
|
|
|
|
→ ${GRUB_ENV}
|
|
|
|
"
|
|
|
|
|
2023-11-11 15:36:57 +00:00
|
|
|
write_env "${GRUBENV}" "\
|
2023-11-10 19:09:15 +00:00
|
|
|
live_name=${PROJECT}
|
|
|
|
data_uuid=${DATA}
|
2023-11-22 21:56:22 +00:00
|
|
|
check_squashfs=enforce
|
|
|
|
live_from=ram
|
|
|
|
pause=999
|
|
|
|
time_out=10
|
2023-11-10 19:09:15 +00:00
|
|
|
"
|
2023-11-11 15:36:57 +00:00
|
|
|
|
|
|
|
write_env "${GRUB_ENV}" "\
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# grub / fonts ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${GRUB_FONTS}
|
|
|
|
"
|
|
|
|
mkdir --parents "${GRUB_FONTS}"
|
2023-09-30 12:46:03 +00:00
|
|
|
for font in $(find '/usr/share/grub' -type 'f' -name '*.pf2') ; do
|
2023-11-13 15:59:24 +00:00
|
|
|
cp "${font}" "${GRUB_FONTS}"
|
2023-09-30 12:46:03 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# grub / themes ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
|
|
|
if cd '/usr/share/grub/themes' ; then
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${GRUB_THEMES}
|
|
|
|
"
|
|
|
|
mkdir --parents "${GRUB_THEMES}"
|
2023-09-30 12:46:03 +00:00
|
|
|
for theme in * ; do
|
|
|
|
if [ -f "${theme}/theme.txt" ] ; then
|
2023-11-13 15:59:24 +00:00
|
|
|
cp --recursive "${theme}" "${GRUB_THEMES}"
|
2023-09-30 12:46:03 +00:00
|
|
|
fi
|
|
|
|
done
|
2023-11-15 11:04:59 +00:00
|
|
|
cd -
|
2023-09-30 12:46:03 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# grub / locales ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
→ ${GRUB_LOCALES}
|
|
|
|
"
|
|
|
|
mkdir --parents "${GRUB_LOCALES}"
|
2023-11-15 11:04:59 +00:00
|
|
|
if cd '/usr/share/locale' ; then
|
|
|
|
for locale in * ; do
|
|
|
|
file="${locale}/LC_MESSAGES/grub.mo"
|
|
|
|
if [ -f "${file}" ] ; then
|
|
|
|
cp "${file}" "${GRUB_LOCALES}/${locale}.mo"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd -
|
|
|
|
fi
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# grub / pubkey ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ ${PGP_PUB}
|
|
|
|
↘ ${GRUB_PUB}
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
gpg --export "${PGP_PUB}" > "${GRUB_PUB}"
|
|
|
|
|
|
|
|
# grub / modules ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-12-13 12:02:12 +00:00
|
|
|
for target in 'x86_64-efi' 'i386-pc' 'arm64-efi' ; do
|
2023-11-13 15:59:24 +00:00
|
|
|
echo -n "
|
|
|
|
↙ /usr/lib/grub/${target}
|
|
|
|
↘ ${GRUB_ROOT}/${target}
|
|
|
|
"
|
2023-11-15 11:04:59 +00:00
|
|
|
if cd "/usr/lib/grub/${target}" ; then
|
|
|
|
mkdir --parents "${GRUB_ROOT}/${target}"
|
|
|
|
for module in *.lst *.mod ; do
|
|
|
|
cp "${module}" "${GRUB_ROOT}/${target}"
|
|
|
|
done
|
|
|
|
cd -
|
|
|
|
fi
|
2023-09-30 12:46:03 +00:00
|
|
|
done
|
2023-11-15 11:04:59 +00:00
|
|
|
|
|
|
|
# project ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
|
|
|
cp --recursive "${ROOT}/live" "${LIVE_ROOT}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# sign ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-15 11:04:59 +00:00
|
|
|
sign "${BIOS_ROOT}"
|
|
|
|
sign "${UEFI_ROOT}"
|
|
|
|
sign "${LIVE_ROOT}"
|
2023-11-08 08:24:45 +00:00
|
|
|
sign "${GRUB_ROOT}"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# display ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-11 15:36:57 +00:00
|
|
|
echo
|
2023-09-30 12:46:03 +00:00
|
|
|
du --human-readable --summarize \
|
2023-11-15 11:04:59 +00:00
|
|
|
"${BIOS_ROOT}" \
|
2023-11-11 15:36:57 +00:00
|
|
|
"${UEFI_ROOT}" \
|
2023-11-15 11:04:59 +00:00
|
|
|
"${LIVE_ROOT}" \
|
|
|
|
"${GRUB_ROOT}" \
|
|
|
|
"${ESP_ROOT}/"
|
|
|
|
echo -n "
|
|
|
|
ESP: ${ESP}
|
|
|
|
DATA: ${DATA}
|
|
|
|
"
|
2023-09-30 12:46:03 +00:00
|
|
|
|
|
|
|
# clean ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
|
|
|
|
|
2023-11-15 11:04:59 +00:00
|
|
|
rm --force --recursive "${MEMDISK_ROOT}"
|