dhcp: add support for dhcpcd

This commit is contained in:
Ariadne Conill 2020-07-25 03:04:02 -06:00
parent c51c9f7103
commit 201e00bbac

View file

@ -3,12 +3,19 @@
set -e set -e
determine_implementation() { determine_implementation() {
[ -x /sbin/dhcpcd ] && echo "dhcpcd" && return
[ -x /sbin/udhcpc ] && echo "udhcpc" && return [ -x /sbin/udhcpc ] && echo "udhcpc" && return
echo "???" echo "???"
} }
start() { start() {
case "$1" in case "$1" in
dhcpcd)
[ -z "$IF_HOSTNAME" ] && optargs="$optargs -h $IF_HOSTNAME"
[ -z "$IF_VENDOR" ] && optargs="$optargs -i $IF_VENDOR"
[ -z "$IF_CLIENT" ] && optargs="$optargs -i $IF_CLIENT"
[ -z "$IF_LEASETIME" ] && optargs="$optargs -l $IF_LEASETIME"
/sbin/dhcpcd $optargs $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
;; ;;
@ -20,6 +27,9 @@ start() {
stop() { stop() {
case "$1" in case "$1" in
dhcpcd)
/sbin/dhcpcd -k $IFACE
;;
udhcpc) udhcpc)
kill $(cat /var/lib/udhcpc.$IFACE.pid) kill $(cat /var/lib/udhcpc.$IFACE.pid)
;; ;;