I try to write a service to set up the network interface.
In Sysvinit I used a script:
IP=$(fw_printenv -n ipaddr)
ifconfig eth0 $IP netmask 255.255.254.0 up
Now I want to do this in a Service:
[Service]
Type=oneshot
Environment="IP=$(/sbin/fw_printenv -n ipaddr)"
ExecStart=/sbin/ifconfig eth0 $IP netmask 255.255.255.0 up
This does not work. In systemctl status -l start-network.service it says:
Oct 23 06:17:29 lcd5a-dsp ifconfig[261]: ifconfig: invalid number 'sbin/fw_printenv'
Does anybody know how to use the output of a function as a variable in a systemd.service?