Yes. dhcpc starts&stops it and /.../config is the config, but you need to
tell dhcpcd to run a script after it gets an IP.
Here's my modified /etc/init.d/dhcpcd
====
#! /bin/sh
# <snip>
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/dhcpcd
NAME=$0
SCR=/etc/dhcpc/startup
test -f $DAEMON || exit 0
# Load up our config file, if present.
if [ -f /etc/dhcpc/config ] ; then
source /etc/dhcpc/config
fi
case "$1" in
start)
if [ "$IFACE" = "none" ] ; then
echo "DHCP client daemon is disabled."
exit
fi
echo -n "Starting DHCP client daemon: dhcpcd"
start-stop-daemon --start --quiet --exec $DAEMON -- -c $SCR $IFACE
echo "."
;;
stop)
echo -n "Stopping DHCP client daemon: dhcpcd"
start-stop-daemon --stop --quiet --exec $DAEMON
echo "."
;;
restart)
$0 stop
$0 start
;;
force-reload)
echo "/etc/init.d/$NAME: force-reload: not implemented"
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop}"
exit 1
;;
esac
exit 0
====
The only diff is the -c $SCR before $IFACE
and the
SCR=/etc/dhcpc/startup
You can then make /etc/dhcpc/startup:
====
#!/bin/sh
# Setup my router
route add default gw $ROUTER
====
-rwxr-xr-x 1 root root 407 Sep 23 17:47 /etc/dhcpc/startup
Then it will config your router nicely for you.
--- Primary e-mail:
, alternate: terpstra@unixg.ubc.ca Residence: 204 Cariboo, Place Vanier, UBC, Canada Company page: www.singularity.home.ml.org, personal: www.iota.ml.org