linux-deployment-scripts/configs/scripts/server.sh

31 lines
714 B
Bash
Raw Normal View History

2024-11-11 07:45:44 +01:00
#!/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
2024-11-11 20:45:42 +01:00
done
2024-11-14 16:25:59 +01:00
2024-11-14 17:08:54 +01:00
echo -e "\nauto ens3\niface ens3 inet static\n address 192.168.1.1\n netmask 255.255.255.0\n gateway 192.168.1.1" | tee -a /mnt/etc/network/interfaces
2024-11-14 16:25:59 +01:00
2024-11-14 16:44:22 +01:00
cp /mnt/root/dhcpd.conf /mnt/etc/dhcp/
2024-11-14 17:08:54 +01:00
sed -i 's/^INTERFACES=.*/INTERFACES="ens3"/' /mnt/etc/default/isc-dhcp-server
2024-11-14 16:25:59 +01:00
2024-11-14 16:36:06 +01:00
read a