dhcp: add dhclient support

This commit is contained in:
Ariadne Conill 2020-07-25 03:06:47 -06:00
parent 201e00bbac
commit 96392f0dd1

View file

@ -4,6 +4,7 @@ set -e
determine_implementation() { determine_implementation() {
[ -x /sbin/dhcpcd ] && echo "dhcpcd" && return [ -x /sbin/dhcpcd ] && echo "dhcpcd" && return
[ -x /usr/sbin/dhclient ] && echo "dhclient" && return
[ -x /sbin/udhcpc ] && echo "udhcpc" && return [ -x /sbin/udhcpc ] && echo "udhcpc" && return
echo "???" echo "???"
} }
@ -16,6 +17,9 @@ start() {
[ -z "$IF_CLIENT" ] && optargs="$optargs -i $IF_CLIENT" [ -z "$IF_CLIENT" ] && optargs="$optargs -i $IF_CLIENT"
[ -z "$IF_LEASETIME" ] && optargs="$optargs -l $IF_LEASETIME" [ -z "$IF_LEASETIME" ] && optargs="$optargs -l $IF_LEASETIME"
/sbin/dhcpcd $optargs $IFACE /sbin/dhcpcd $optargs $IFACE
dhclient)
/usr/sbin/dhclient -pf /var/run/dhclient.$IFACE.pid $IFACE
;;
udhcpc) udhcpc)
/sbin/udhcpc -b -R -p /var/run/udhcpc.$IFACE.pid -i $IFACE /sbin/udhcpc -b -R -p /var/run/udhcpc.$IFACE.pid -i $IFACE
;; ;;
@ -30,8 +34,11 @@ stop() {
dhcpcd) dhcpcd)
/sbin/dhcpcd -k $IFACE /sbin/dhcpcd -k $IFACE
;; ;;
dhclient)
kill -9 $(cat /var/run/dhclient.$IFACE.pid) 2>/dev/null
;;
udhcpc) udhcpc)
kill $(cat /var/lib/udhcpc.$IFACE.pid) kill $(cat /var/run/udhcpc.$IFACE.pid)
;; ;;
*) *)
echo "implementation $1 not supported" echo "implementation $1 not supported"