|
|
|
|
@@ -26,6 +26,14 @@ fail_or_warn() {
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# grub.cfg and live.cfg may not exist yet when binary hooks run — live-build
|
|
|
|
|
# creates them after this hook (lb binary_grub-efi / lb binary_syslinux).
|
|
|
|
|
# The template already has memtest entries hardcoded, so a missing config file
|
|
|
|
|
# here is not an error; validate_iso_memtest() checks the final ISO instead.
|
|
|
|
|
warn_only() {
|
|
|
|
|
log "WARNING: $1"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
copy_memtest_file() {
|
|
|
|
|
src="$1"
|
|
|
|
|
dst_name="${2:-$(basename "$src")}"
|
|
|
|
|
@@ -61,15 +69,17 @@ extract_memtest_from_deb() {
|
|
|
|
|
|
|
|
|
|
download_and_extract_memtest() {
|
|
|
|
|
tmpdl="$(mktemp -d)"
|
|
|
|
|
ver_arg=""
|
|
|
|
|
if [ -n "${MEMTEST_VERSION:-}" ]; then
|
|
|
|
|
ver_arg="=memtest86+=${MEMTEST_VERSION}"
|
|
|
|
|
log "downloading memtest86+=${MEMTEST_VERSION} from apt"
|
|
|
|
|
pkg_spec="memtest86+=${MEMTEST_VERSION}"
|
|
|
|
|
else
|
|
|
|
|
log "downloading memtest86+ from apt (no version pinned)"
|
|
|
|
|
pkg_spec="memtest86+"
|
|
|
|
|
fi
|
|
|
|
|
log "downloading ${pkg_spec} from apt"
|
|
|
|
|
if ! ( cd "$tmpdl" && apt-get download "$pkg_spec" 2>/dev/null ); then
|
|
|
|
|
log "apt download failed, retrying after apt-get update"
|
|
|
|
|
apt-get update -qq >/dev/null 2>&1 || true
|
|
|
|
|
( cd "$tmpdl" && apt-get download "$pkg_spec" 2>/dev/null ) || true
|
|
|
|
|
fi
|
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
|
( cd "$tmpdl" && apt-get download "memtest86+${ver_arg}" ) 2>/dev/null || true
|
|
|
|
|
deb="$(find "$tmpdl" -maxdepth 1 -type f -name 'memtest86+*.deb' 2>/dev/null | head -1)"
|
|
|
|
|
if [ -n "$deb" ]; then
|
|
|
|
|
extract_memtest_from_deb "$deb"
|
|
|
|
|
@@ -133,7 +143,7 @@ ensure_memtest_binaries() {
|
|
|
|
|
|
|
|
|
|
ensure_grub_entry() {
|
|
|
|
|
[ -f "$GRUB_CFG" ] || {
|
|
|
|
|
fail_or_warn "missing ${GRUB_CFG}"
|
|
|
|
|
warn_only "missing ${GRUB_CFG} (will be created by lb binary_grub-efi from template)"
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -159,7 +169,7 @@ EOF
|
|
|
|
|
|
|
|
|
|
ensure_isolinux_entry() {
|
|
|
|
|
[ -f "$ISOLINUX_CFG" ] || {
|
|
|
|
|
fail_or_warn "missing ${ISOLINUX_CFG}"
|
|
|
|
|
warn_only "missing ${ISOLINUX_CFG} (will be created by lb binary_syslinux from template)"
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|