#!/bin/bash # # Debian based script after the VM deployment # (C) by Mr.Zsolt # Input variables HOSTNAME=$1 DOMAINSUFFIX=$2 IP=$3 GATEWAY=$4 NEWPASS=$5 # Change hostname echo $HOSTNAME > /etc/hostname # Change domain sed -i '/Debian-template/c\'"$IP"'\t'"$DOMAINSUFFIX"'\t'"$HOSTNAME"'' /etc/hosts # Make the interfaces file echo "# This file describes the network interfaces available on your system" > /etc/network/interfaces echo "# and how to activate them. For more information, see interfaces(5)." >> /etc/network/interfaces echo "" >> /etc/network/interfaces echo "# The loopback network interface" >> /etc/network/interfaces echo "auto lo" >> /etc/network/interfaces echo "iface lo inet loopback" >> /etc/network/interfaces echo "" >> /etc/network/interfaces echo "allow-hotplug eth0" >> /etc/network/interfaces echo "iface eth0 inet static" >> /etc/network/interfaces echo " address $IP" >> /etc/network/interfaces echo " netmask 255.255.255.0" >> /etc/network/interfaces echo " gateway $GATEWAY" >> /etc/network/interfaces # Change root password usermod --password $(echo $NEWPASS | openssl passwd -1 -stdin) root # Remove myself rm -rf /root/customization.sh # Reboot when done reboot