linux-deployment-scripts/configs/scripts/server.sh
2024-11-15 16:47:57 +01:00

30 lines
800 B
Bash
Executable file

#!/bin/bash
# This file is part of VM-Experiments.
# Licensed under the GPL-3.0-or-later. See LICENSE for details.
trap '' SIGINT SIGTERM
while true; do
chroot /mnt /bin/bash -c "passwd root"
if [ $? -eq 0 ]; then
break
fi
done
while true; do
read -p "Enter the hostname: " hostname
chroot /mnt /bin/bash -c "echo $hostname > /etc/hostname"
if [ $? -eq 0 ]; then
break
fi
done
echo -e "\nauto enp0s3\niface enp0s3 inet static\n address 192.168.1.1\n netmask 255.255.255.0\n gateway 192.168.1.0\n dns-nameservers 192.168.1.1" | tee -a /mnt/etc/network/interfaces
cp /mnt/root/dhcpd.conf /mnt/etc/dhcp/
sed -i 's/^INTERFACESv4=.*/INTERFACESv4="enp0s3"/' /mnt/etc/default/isc-dhcp-server
chroot /mnt /bin/bash -c "systemctl enable bind9"