#!/bin/bash

setup_target() {
    echo "blacklist ti-am65-cpsw-nuss" > /etc/modprobe.d/blacklist.conf
    mac_address=$(ifconfig | awk -F"[ ]+" '/ether/{print $3}')
    sed -i 's/\(MASTER0_DEVICE="\).*/\1'"$mac_address"'"/' /opt/etherlab/ethercat.conf
    sed -i 's/\(DEVICE_MODULES="\).*/\1ti-am65-cpsw-nuss"/' /opt/etherlab/ethercat.conf
    reboot
}

setup_target