#!/bin/bash
# SPDX-Version: 3.0
# SPDX-CreationInfo: 2025-05-05; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.live.builder.git
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
# SPDX-PackageName: CISS.debian.live.builder
# SPDX-Security-Contact: security@coresecret.eu

guard_sourcing

#######################################
# Notes Textbox
# Arguments:
#  None
#######################################
check_provider() {
  clear
  cat << EOF >| "${VAR_NOTES}"
Build  : ${VAR_VERSION}
Commit : ${VAR_GIT_REL}

Press 'EXIT' to continue with CISS.debian.live.builder.

When you provision ISO images using the Netcup provider, you MUST always supply a globally unique identifier
for each image via the --control argument. If you omit this flag or reuse an existing identifier, Netcup's
backend will automatically locate and mount the oldest ISO carrying that same name. In practice, this means
you might believe you're booting a freshly uploaded image, but in fact, the system silently reattaches an
earlier one-leading to confusing failures and wasted troubleshooting time.

A separate but related issue emerges when booting certain Debian "cloud" kernel images-specifically those
matching the patterns *.+bpo-cloud-amd64 or *.+bpo-cloud-arm64-on a Netcup G11 instance or on a Hetzner VM.
After the initramfs is loaded, the console output often becomes garbled or completely unreadable. This is not
due to a kernel panic, but rather to a mismatch between the framebuffer mode expected by the initramfs and the
one actually provided by the virtual hardware. Common workarounds, like editing the boot entry (e) and appending

- 'nomodeset', or
- 'vga=0x318',

do not resolve the issue because they address legacy VGA modes rather than the EFI framebuffer parameters used
in modern cloud images.

To mitigate this, you can:

- Use a plain Debian kernel (e.g., linux-image-amd64) instead of the bpo-cloud variants, which are optimized
  for cloud-init but presume a different console setup.

- Explicitly set an EFI-compatible framebuffer by adding something like 'video=efifb:mode=auto' to the kernel
  command line. This aligns the initramfs console driver with the actual firmware framebuffer.

- Build a custom initramfs that includes the correct video modules or switches back to a serial console. For
  example, adding 'console=ttyS0,115200' can force all early messages to the serial port bypassing the
  graphical framebuffer entirely.
EOF

  dialog --no-collapse \
         --ascii-lines \
         --clear \
         --backtitle "CISS.debian.live.builder" \
         --title "Important Notes" \
         --scrollbar \
         --textbox "${VAR_NOTES}" 32 128
  clear
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
