#!/bin/sh

set -e

# Generate a list of packages required for debian-installer
# This script makes use of the following variables that need to be preset:
# MIRROR, CODENAME
if [ "$MIRROR"x = ""x ] ; then
    echo "\$MIRROR unset; abort!"
    exit 1
fi
if [ "$CODENAME"x = ""x ] ; then
    echo "\$CODENAME unset; abort!"
    exit 1
fi
if [ "$DI_CODENAME"x = ""x ] ; then
    echo "\$DI_CODENAME unset; abort!"
    exit 1
fi

DATE=`date`
cat > debian-installer+kernel << EOF
/* These packages + the ones needed by debootstrap are the ones needed for
 * debian-installer to be able to install a base Debian system.
 *
 * These packages are installed by various parts of the debian-installer,
 * mostly via its apt-install command.
 *
 * This list can be generated with the command:
 * ../tools/generate_di+k_list
 *
 * DO NOT EDIT THIS FILE, edit the above script
 *
 * Last update: $DATE
 */

#include <debian-installer>

/* Hardware config */
eject
pciutils
usbutils
keyboard-configuration
console-setup
pcmciautils
acpi
acpid
acpi-support-base
pbbuttonsd
mouseemu
udev
discover

/* Storage and filesystem tools */
e2fsprogs
dmsetup
lvm2
mdadm
xfsprogs
jfsutils
dosfstools
reiserfsprogs
btrfs-tools
btrfs-progs
ufsutils
zfsutils
cryptsetup
loop-aes-utils
dmraid
open-iscsi
/* multipath-tools-boot is used for multipath support and installed
 * during installation process if multipath is used
 */
multipath-tools-boot

/* Networking */
wireless-tools
ppp
pppoeconf
pptp-linux
/* #593914: netinsts are being used on wireless too these days. */
wpasupplicant
/* #782299: netcfg will install rdnssd, make sure it's on our media */
rdnssd

/* Misc d-i */
installation-report
openssh-server
popularity-contest
os-prober
locales

/* Needed for some languages with bi-directional support */
libfribidi0

/* Needed for rootless installs. */
sudo

/* #855035: make sure we have the bits on media for https package downloads */
apt-transport-https
ca-certificates

/* laptop-detect is used by tasksel when checking if the system is a
 * laptop so we have to make sure to get it included on first CD for
 * arches that are know to have laptops
 */

/* add the list of firmware packages here too if required */
#ifdef FORCE_FIRMWARE
#    include <firmware>
#endif

#ifdef ARCH_i386
initramfs-tools
busybox
grub-pc
grub-efi
grub-efi-ia32
grub-efi-ia32-bin
shim-signed
laptop-detect
libc6-i686
/* Note that we do not have to include every optimised kernel flavor for
 * i386, but this does control what kernels are available on the netinst CD.
 * Kernel headers are included as third party modules are commonly
 * used on this architecture.
 */
#ifndef ARCH_i386_EXCLUDE_486_KERNEL
linux-image-486
linux-headers-486
#endif
#ifndef ARCH_i386_EXCLUDE_586_KERNEL
linux-image-586
linux-headers-586
#endif
#ifndef ARCH_i386_EXCLUDE_686_KERNEL
linux-image-686
linux-headers-686
#endif
#ifndef ARCH_i386_EXCLUDE_686_PAE_KERNEL
linux-image-686-pae
linux-headers-686-pae
#endif

#endif

#ifdef ARCH_amd64
initramfs-tools
busybox
grub-pc
grub-efi
grub-efi-amd64
grub-efi-amd64-bin
grub-efi-amd64-signed
shim-signed
laptop-detect
linux-image-amd64
linux-headers-amd64
#endif

#ifdef ARCH_ia64
initramfs-tools
busybox
grub-efi
grub-efi-ia64
grub-efi-ia64-bin
linux-image-itanium
linux-image-itanium-smp
linux-image-mckinley
linux-image-mckinley-smp
#endif

#ifdef ARCH_mips
initramfs-tools
arcboot
sibyl
linux-image-octeon
linux-image-r4k-ip22
linux-image-r5k-ip32
linux-image-sb1-bcm91250a
linux-image-sb1a-bcm91480b
#endif

#ifdef ARCH_mipsel
initramfs-tools
sibyl
colo
delo
linux-image-loongson-2e
linux-image-loongson-2f
linux-image-loongson-3
linux-image-r3k-kn02
linux-image-r4k-kn04
linux-image-r5k-cobalt
linux-image-sb1-bcm91250a
linux-image-sb1a-bcm91480b
#endif

#ifdef ARCH_armel
initramfs-tools
busybox
slugimage
flash-kernel
nslu2-utils
apex-nslu2
linux-image-iop32x
linux-image-ixp4xx
linux-image-kirkwood
linux-image-mv78xx0
linux-image-orion5x
linux-image-versatile
#endif

#ifdef ARCH_armhf
initramfs-tools
busybox
flash-kernel
linux-image-armmp
linux-image-armmp-lpae
grub-efi
grub-efi-arm
grub-efi-arm-bin
#endif

#ifdef ARCH_arm64
initramfs-tools
busybox
flash-kernel
linux-image-arm64
grub-efi
grub-efi-arm64
grub-efi-arm64-bin
grub-efi-arm64-signed
shim-signed
#endif

#ifdef ARCH_sparc
initramfs-tools
grub-ieee1275
busybox
libc6-sparcv9b
libc6-sparcv9
linux-image-sparc32
linux-image-sparc32-smp
linux-image-sparc64
linux-image-sparc64-smp
#endif

#ifdef ARCH_sparc64
initramfs-tools
grub-ieee1275
busybox
linux-image-sparc64
linux-image-sparc64-smp
#endif

#ifdef ARCH_m68k
initramfs-tools
busybox
linux-image-m68k
#endif

#ifdef ARCH_powerpc
initramfs-tools
grub-ieee1275
busybox
laptop-detect
quik
powerpc-utils
hfsutils
mkvmlinuz
linux-image-powerpc
linux-image-powerpc-smp
linux-image-powerpc64
linux-image-prep
#endif

#ifdef ARCH_ppc64
initramfs-tools
grub-ieee1275
busybox
hfsutils
powerpc-utils
powerpc-ibm-utils
linux-image-powerpc64
#endif

#ifdef ARCH_ppc64el
initramfs-tools
grub-ieee1275
busybox
powerpc-utils
powerpc-ibm-utils
linux-image-powerpc64le
#endif

#ifdef ARCH_alpha
initramfs-tools
busybox
aboot
linux-image-alpha-generic
linux-image-alpha-smp
#endif

#ifdef ARCH_hppa
initramfs-tools
busybox
palo
linux-image-parisc
linux-image-parisc64-smp
#endif

#ifdef ARCH_kfreebsd_amd64
kfreebsd-image-10-amd64
grub-pc
#endif

#ifdef ARCH_kfreebsd_i386
kfreebsd-image-10-486
kfreebsd-image-10-686
grub-pc
libc0.1-i686
#endif

#ifdef ARCH_hurd_i386
gnumach-image-1-486
grub-pc
libc0.3-i686
#ifdef VARIANT_xen
gnumach-image-1-xen-486
libc0.3-xen
#endif
#endif

#if defined(ARCH_s390) || defined(ARCH_s390x)
s390-tools
sysconfig-hardware
#endif
EOF
