packages/net/isc-dhcp/files/dhclient.init
Philip Prindeville 8a52c2b742 isc-dhcp: use network_get_device in client scripts
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2023-07-25 15:55:14 -06:00

30 lines
509 B
Bash

#!/bin/sh /etc/rc.common
START=60
lease_file=/var/dhclient.leases
config_file=/etc/dhclient.conf
pid_file=/var/run/dhclient.pid
script_file=/usr/sbin/dhclient-script
start() {
local ifname
. /lib/functions/network.sh
network_get_device ifname "wan" || return 1
/usr/sbin/dhclient -q -nw -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file $ifname
[ $? -eq 0 ] || return 1
}
stop() {
[ -e $pid_file ] || return 1
kill -9 $(cat $pid_file)
[ $? -eq 0 ] || return 1
rm $pid_file
}