Ubuntu image: add haveged, nosplash boot, uncloud-init

This commit is contained in:
fnux 2020-01-25 18:20:38 +01:00
parent 5bac25f2a8
commit 7eacf4c8f5

View file

@ -120,11 +120,15 @@ run_root DEBIAN_FRONTEND=noninteractive apt-get -y install locales linux-base li
# Configure grub. # Configure grub.
run_root grub-install --target=i386-pc "${NBD_DEVICE}" run_root grub-install --target=i386-pc "${NBD_DEVICE}"
sed -i 's/quiet splash/nosplash/' /mnt/etc/default/grub
run_root grub-mkconfig -o /boot/grub/grub.cfg run_root grub-mkconfig -o /boot/grub/grub.cfg
# Install en configure SSH daemon. The service is enabled by default. # Install en configure SSH daemon. The service is enabled by default.
run_root apt-get -y install openssh-server run_root apt-get -y install openssh-server
# Use haveged as entropy source.
run_root apt-get -y install haveged
# Generate fstab file. # Generate fstab file.
boot_uuid=$(blkid --match-tag UUID --output value "${NBD_DEVICE}p1") boot_uuid=$(blkid --match-tag UUID --output value "${NBD_DEVICE}p1")
root_uuid=$(blkid --match-tag UUID --output value "${NBD_DEVICE}p2") root_uuid=$(blkid --match-tag UUID --output value "${NBD_DEVICE}p2")
@ -141,9 +145,19 @@ rm -f /var/lib/systemd/random-seed
# Remove temporary files and reclaim freed disk space. # Remove temporary files and reclaim freed disk space.
run_root apt-get clean run_root apt-get clean
# FIXME: add fnux's SSH key for testing purposes. # Manually install uncloud-init.
mkdir -p /mnt/root/.ssh uncloud_init_dir=/tmp/uncloud-init
curl https://key.wf/fnux > /mnt/root/.ssh/authorized_keys run_root apt-get install -y git curl grep make
mkdir -p "$uncloud_init_dir"
run_root git clone https://code.ungleich.ch/uncloud/uncloud-init.git "$uncloud_init_dir"
run_root make -C "$uncloud_init_dir" install
run_root rm -r "$uncloud_init_dir"
run_root systemctl enable uncloud-init
# Remove resolv.conf, as it is handled by uncloud-init.
run_root rm /etc/resolv.conf
# Make sure everything is written to disk before exiting. # Make sure everything is written to disk before exiting.
sync sync