### Preseed for Ubuntu 18.04
# Derived from: https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
# Derived again from https://gist.github.com/CalvinHartwell/f2d7f5dedbfee2d7d47c583539a10859

d-i auto-install/enable boolean true

d-i debian-installer/language string en
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/country string US
d-i keyboard-configuration/xkb-keymap select US

d-i /choose_interface select auto
# d-i netcfg/hostname string device
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i hw-detect/load_firmware boolean true

### Account setup
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password !!
d-i passwd/make-user boolean false

d-i clock-setup/utc boolean true
d-i time/zone string UTC
d-i clock-setup/ntp boolean true

d-i clock-setup/ntp-server string 10.100.202.175

d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto/choose_recipe select atomic
d-i partman/default_filesystem string ext4
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
#d-i partman-auto-lvm/new_vg_name string vg-root
#d-i partman-auto-lvm/guided_size string max

### Grub
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true

### Base system installation
d-i base-installer/install-recommends boolean true
d-i base-installer/kernel/image string linux-generic
d-i debconf debconf/frontend select Noninteractive

d-i mirror/http/hostname string 10.100.202.204
d-i mirror/http/directory string /ubuntu
d-i mirror/http/mirror select 10.100.202.204

d-i passwd/root-password password changeme
d-i passwd/root-password-again password changeme

d-i user-setup/encrypt-home boolean false


### Package selection
d-i tasksel/first multiselect none
d-i pkgsel/upgrade select full-upgrade
d-i pkgsel/include string openssh-server \
    vim \
    byobu \
    git \
    tmux \
    build-essential \
    open-vm-tools \
    telnet \
    wget \
    curl \
    python

#d-i preseed/late_command string \
# in-target sh -c 'mkdir -p --mode=0700 /root/.ssh'; \
# in-target sh -c 'curl https://sneak.cloud/authorized_keys > /root/.ssh/authorized_keys'; \
# in-target sh -c 'chmod 0600 /root/.ssh/authorized_keys';  \
# in-target sh -c 'echo "IPv4: \\\4" >> /etc/issue && echo "IPv6: \\\6" >> /etc/issue && echo "" >> /etc/issue';

d-i debian-installer/splash boolean false

# reboot:
d-i finish-install/reboot_in_progress note
