#!/usr/bin/expect # 0.2 # Script connects to localhost 3355 and install VyOS network OS # spawn telnet localhost 3355 set timeout 120 send "\r" expect "vyos login:" send "vyos\r" expect "Password:" send "vyos\r" expect "*$*" send "install system\n" expect "*Would you like to continue?*" send "\r" expect "*Partition (Auto/Union/Parted/Skip)*" send "\r" expect "*Install the image on?*" send "\r" expect "*This will destroy all data*" send "Yes\r" expect "*How big of a root partition should I create?*" send "\r" expect "*Which one should I copy to sda?*" send "\r" expect "*Enter password for user*" send "vyos\r" expect "*Retype password*" send "vyos\r" expect "*Which drive should*" send "\r" expect "*$*" send "sudo su\r" expect "*#*" send "mount -t ext4 /dev/sda1 /tmp\r" expect "*#*" send "mv /tmp/lib/udev/vyatta_net_name /tmp/lib/udev/vyatta_net_name.bak\r" expect "*#*" send "mv /tmp/lib64/udev/vyatta_net_name /tmp/lib64/udev/vyatta_net_name.bak\r" expect "*#*" send "sed -i 's/2367abef/00/g' /tmp/lib/udev/rules.d/75-persistent-net-generator.rules\r" expect "*#*" send "sed -i 's/2367abef/00/g' /tmp/lib64/udev/rules.d/75-persistent-net-generator.rules\r" expect "*#*" send "sed -i 's/set default=0/set default=1/g' /tmp/boot/grub/grub.cfg\r" expect "*#*" send "\x1d" expect "telnet>" send "quit\r"