#!/bin/sh #save our current network interface config for merging with eveng network config later cp /etc/network/interfaces ./interfaces #save our current ssh key sed -i -e "s/PermitRootLogin .*/PermitRootLogin yes/" /etc/ssh/sshd_config wget -O - http://www.eve-ng.net/repo/eczema@ecze.com.gpg.key | sudo apt-key add - apt-get update apt-get -y install software-properties-common sudo add-apt-repository "deb [arch=amd64] http://www.eve-ng.net/repo xenial main" apt-get update DEBIAN_FRONTEND=noninteractive apt-get -y install eve-ng /etc/init.d/mysql restart mv /etc/rc.local /etc/eve-setup.sh #eve install sets ifnames to 0 which overwrites grubs serial output #here we add the ifnames setting and our serial output to grub sed -i -e 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=""/' /etc/default/grub sed -i -e 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="net.ifnames=0 console=ttyS1,115200"/' /etc/default/grub update-grub #after boot the interface names will change do to the ifnames kernel option specified above # here we rename rename the interfaces sed -i -e 's/enp0s20f0/eth0/' ./interfaces sed -i -e 's/enp0s20f1/eth1/' ./interfaces sed -i -e 's/p1p1/eth0/' ./interfaces sed -i -e 's/p1p2/eth1/' ./interfaces sed -i -e 's/bond0/pnet0/' ./interfaces # add cloud interfaces cat >> ./interfaces << EOF # Cloud devices iface eth2 inet manual auto pnet2 iface pnet2 inet manual bridge_ports eth2 bridge_stp off iface eth3 inet manual auto pnet3 iface pnet3 inet manual bridge_ports eth3 bridge_stp off iface eth4 inet manual auto pnet4 iface pnet4 inet manual bridge_ports eth4 bridge_stp off iface eth5 inet manual auto pnet5 iface pnet5 inet manual bridge_ports eth5 bridge_stp off iface eth6 inet manual auto pnet6 iface pnet6 inet manual bridge_ports eth6 bridge_stp off iface eth7 inet manual auto pnet7 iface pnet7 inet manual bridge_ports eth7 bridge_stp off iface eth8 inet manual auto pnet8 iface pnet8 inet manual bridge_ports eth8 bridge_stp off iface eth9 inet manual auto pnet9 iface pnet9 inet manual bridge_ports eth9 bridge_stp off EOF mv ./interfaces /etc/network/interfaces #add a new systemd file to ensure apache2 starts cat >> /lib/systemd/system/apache2.service.d/apache2-systemd.conf << EOF [Unit] Description=Apache HTTP Server After=syslog.target network.target [Service] Type=forking RemainAfterExit=no Restart=always PIDFile=/var/run/apache2/apache2.pid [Install] WantedBy=multi-user.target EOF #here we touch a file to signal to eve-ng that everything is already configured touch /opt/ovf/.configured exit 0