From a7e27ffa2ceff4d26d74b968f0596e9c1d5d1953 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 11 Sep 2020 02:31:22 -0600 Subject: [PATCH 1/2] dhcp: support IF_HOSTNAME, IF_SCRIPT and IF_CLIENT for udhcpc --- executor-scripts/linux/dhcp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/executor-scripts/linux/dhcp b/executor-scripts/linux/dhcp index 783f6e1..0a2b04c 100755 --- a/executor-scripts/linux/dhcp +++ b/executor-scripts/linux/dhcp @@ -24,8 +24,11 @@ start() { ${MOCK} /usr/sbin/dhclient -pf /var/run/dhclient.$IFACE.pid $IFACE ;; udhcpc) - UDHCPC_OPTS=$(eval echo $IF_UDHCPC_OPTS) - ${MOCK} /sbin/udhcpc -b -R -p /var/run/udhcpc.$IFACE.pid -i $IFACE $UDHCPC_OPTS + optargs=$(eval echo $IF_UDHCPC_OPTS) + [ -n "$IF_HOSTNAME" ] && optargs="$optargs -x hostname:$IF_HOSTNAME" + [ -n "$IF_CLIENT" ] && optargs="$optargs -c $IF_CLIENT" + [ -n "$IF_SCRIPT" ] && optargs="$optargs -s $IF_SCRIPT" + ${MOCK} /sbin/udhcpc -b -R -p /var/run/udhcpc.$IFACE.pid -i $IFACE $optargs ;; *) ;; From 5d4e3699b29b1ce9d83626ebb5723587a32d523f Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 11 Sep 2020 02:33:54 -0600 Subject: [PATCH 2/2] dhcp: evaluate IF_HOSTNAME for shell fragments --- executor-scripts/linux/dhcp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/executor-scripts/linux/dhcp b/executor-scripts/linux/dhcp index 0a2b04c..82ae793 100755 --- a/executor-scripts/linux/dhcp +++ b/executor-scripts/linux/dhcp @@ -2,6 +2,9 @@ set -e +# some users provide a shell fragment for the hostname property. +[ -n "$IF_HOSTNAME" ] && IF_HOSTNAME=$(eval echo $IF_HOSTNAME) + determine_implementation() { [ -n "$IF_DHCP_PROGRAM" ] && echo "$IF_DHCP_PROGRAM" && return [ -x /sbin/dhcpcd ] && echo "dhcpcd" && return