#!/bin/bash echo "" echo "##########################################" echo "## FIRSTRUN INIT SCRIPT ##" echo "## WAIT SOME MINUTES FOR CONFIGURATIONS ##" echo "##########################################" echo "" echo "######################" echo "# ssh key generation #" echo "######################" echo "" rm -f /etc/ssh/ssh_host* dpkg-reconfigure openssh-server /bin/systemctl disable firstrun if [ ! -e /etc/crypttab ]; then echo "" echo "############################" echo "# Expanding root partition #" echo "############################" (echo d; echo n; echo p; echo 1; echo ; echo; echo w) | fdisk /dev/mmcblk0 /bin/systemctl enable secondrun echo "" echo "##################" echo "# reboot #" echo "##################" echo "" /sbin/reboot else echo "" echo "####################" echo "# update initramfs #" echo "####################" echo "" rm /etc/initramfs-tools/stunnel.{csr,key,pem} echo > /etc/initramfs-tools/root/.ssh/authorized_keys rm /etc/initramfs-tools/root/.ssh/id_* rm /etc/initramfs-tools/etc/dropbear/dropbear_* /usr/sbin/update-initramfs -u -k all fi exit 0