Created
May 26, 2020 22:13
-
-
Save dkmonaghan/0237d0d3b21586b4572fe83419504f3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f "/sys/class/net/ens192/address" ]; then | |
# Temporarily bring up the network | |
sed -i 's/eth0/ens192/g' /etc/network/interfaces | |
service networking restart | |
fi | |
# Apt-get update | |
apt-get update | |
# Remove hyperv-daemons | |
apt-get remove -y hyperv-daemons | |
# Install open-vm-tools | |
apt-get install -y open-vm-tools | |
if [ -f "/sys/class/net/ens192/address" ]; then | |
# Configure network interface | |
cat >> /etc/systemd/network/10-eth0.link <<EOL | |
[Match] | |
MACAddress=`cat /sys/class/net/ens192/address` | |
[Link] | |
Name=eth0 | |
EOL | |
# Set interfaces file back to eth0 | |
sed -i 's/ens192/eth0/g' /etc/network/interfaces | |
# Update initramfs | |
update-initramfs -u | |
fi | |
# Remove myself | |
apt-get remove -y vmwaremigrate | |
echo "Done! VM Configured. Rebooting in 3 seconds..." | |
sleep 3 | |
# Reboot system | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment