I need to set the IP address of a ubuntu device() to be read from an EEPROM. The user has he option to change the IP address as well.
I know the commands to read and write to the EEPROM. But how do I edit the /etc/network/interfaces
file so that it automatically fetches the IP address from the EEPROM on network start/restart?
Btw..I am aware of the methods to configure static IP address the normal way. But in that method, I could only hardcode the IP address in the interfaces file. Is there any way I can make this a variable, which I can populate from EEPROM and use in the interfaces file?
Also, I know that I can do the whole thing using a shell script by calling the EEPROM command and ifconfig. But I would like to do this using the standard init scripts. Also I need DHCP configuration to happen in the standard way.
dd if=sys/bus/i2c/drivers/at24/0-0050/eeprom count=1 bs=1 skip=48
But I can warp this in a script and return whatever I want. I am more concerned about how this string can be used in the configuration file.of=/tmp/eeprom.txt
parameters to ´dd´ and post the contents of the fileeeprom.txt
to paste.ubuntu.com and provide a link back (also in your question)