Currently having issues when attempting to run a MAC changing script on startup.
Currently running ChromeOS which is using upstart as it's init system however I've attempted multiple different ways to make the script run at boot with no luck.
Running the script alone via sudo sh updatemac.sh has it working correctly, code here:
#!/bin/bash
NEW_MAC=`echo -n 00; hexdump -n 5 -v -e '/1 ":%02X"' /dev/urandom;`
ifconfig wlan0 down
ifconfig wlan0 hw ether $NEW_MAC
ifconfig wlan0 up
I've attempted to create a startup job a few different ways.
First way was placing updatemac.conf in /etc/init with the code:
start on star-user-session
task
script
NEW_MAC=`echo -n 00; hexdump -n 5 -v -e '/1 ":%02X"' /dev/urandom;`
ifconfig wlan0 down
ifconfig wlan0 hw ether $NEW_MAC
ifconfig wlan0 up
end script
However that didn't work. I also tried replacing the script / end script section with both
exec /home/user/chronos/Downloads/updatemac.sh
And
exec sh /home/user/chronos/Downloads/updatemac.sh
Neither of which worked.
The other way I tried was adding the script directly to /etc/init.d/updatemac.sh
However that also failed for me.
Solved it, seems it needed
start on started system-services
In the .conf for /etc/init instead of
start on star-user-session
Also removed "task" from the script.