The problem is that it works about 50% of the time only, which makes me think that it's either a race condition or that something else is wrong.
This is my script:
/etc/init.d/startup
Code: Select all
#!/bin/sh
### BEGIN INIT INFO
# Provides: macchanger
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Changes the MAC address at boot time.
# Description: Changes the ethernet and wireless cards MAC addresses
# that begins with a real manufacturers MAC (the first 3
# segments) and randomize the next 3 segments.
### END INIT INFO
# Disable the network devices
#ifconfig eth0 down
ifconfig wlan0 down
echo "Changing MAC address" >&2
# Spoof the mac addresses
#/usr/bin/macchanger -r eth0
/usr/bin/macchanger -r wlan0
# Re-enable the devices
#ifconfig eth0 up
ifconfig wlan0 up
start() {
echo 'Service started' >&2
}
stop() {
echo 'Service not running' >&2
}
uninstall() {
echo "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
}
case "$1" in
start)
start
;;
stop)
stop
;;
uninstall)
uninstall
;;
retart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|uninstall}"
esac
exit 0
to have it run with low priorities and only in run level 5 (that's how interpret the man page of update-rc.d).update-rc.d startup defaults 100 5
Like I mentioned above, the script runs. But the MAC only changes about half of the time.
Any advice on how to get this working?
I've been stuck with this now for a few days.
Another thing I tried was to set it via rc.local and have it run when the user logged in, but that seems to have similar results.