#!/bin/bash
echo "Please enter the new hostname for this server:"
read hostname
sed -i "s/new-arch-vm/$hostname/g" /etc/hosts
sed -i "s/new-arch-vm/$hostname/g" /etc/hostname
rm -f /etc/ssh/ssh_host*
ssh-keygen -A
e2label /dev/disk/by-label/root ${hostname}-root
sed -i "s/LABEL=root/LABEL=${hostname}-root/" /etc/fstab
sed -i "s/LABEL=root/LABEL=${hostname}-root/" /boot/syslinux/syslinux.cfg
syslinux-install_update -iam
mkinitcpio -p linux
systemctl enable collectd
sed -i "s#/firstboot.sh##g" /root/.zshrc-addon
mv /firstboot.sh /tmp
echo "Press enter to reboot now, or ctrl+c to exit"
read
reboot