To get a script to run at boot in Debian:
The script must be LSB complient and be placed in /etc/init.d, then registered.
Below is a sample of your script with an LSB header, in this example you would name it-> "randommac", and place it in /etc/init.d
### BEGIN INIT INFO
# Provides: randommac
# Required-Start: mountdevsubfs
# Should-Start: networking
# Default-Start: 2 3 4 5
# Default-Stop: 1 0 6
# Short-Description: Configure network devices with random mac adderess
### END INIT INFO
killall /opt/wicd/daemon.py # closes use of eth0 by Wicd
ifconfig eth0 down # deactivate eth0
macchanger -A eth0 # change mac address for eth0
sleep 1 # wait a little to get different random mac addresses
macchanger -A wlan0 # change mac address for wlan0
ifconfig wlan0 up # activates wlan0
/opt/wicd/daemon.py 2> /dev/null # starts Wicd daemon again
/opt/wicd/tray-dapper.py 2> /dev/null # starts the Wicd tray
After placing the randommac script in /etc/init.d, register it with these two commands as root or sudo:
chmod 0755 /etc/init.d/randommac
update-rc.d randommac defaults
Upon reboot, the script should be launched, if it did not produce the desired effects, there may be a problem in the design of the script or it was not started at the right time in the boot sequence.
The LSB header in this example will have this script started after the networking script which is also in /etc/init.d as defined by the "# Should-Start:" entry in the LSB header. If you want to try starting it somewhere else in the boot sequence for troubleshooting purposes, install insserv and graphviz to view the boot sequence of scripts and change the "# Should-Start:" entry to include the script in the graph produced by graphviz prior to where you want randommac to run.
To use graphviz to see the boot sequence of boot scripts, install insserv and graphviz and run a couple commands as such:
aptitude install insserv graphviz
/usr/share/insserv/check-initd-order -g > boot.dot
After running the two commands following the aptitude install command, a graph should pop up, navigate using arrow keys to scroll the entire graph to find your "randommac" script.
To get more info on LSB complient scripts, check this link
If you make changes to the script after finding it does not work, ensure the permissions are set to 0755 as defined by the chmod command suggested earlier.