From 96e720bb6b3944b0a0c551eff16d50ab6f884cc9 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Sat, 23 Sep 2023 17:09:30 -0600 Subject: [PATCH] isc-dhcp: Use 'append' instead of manually appending Signed-off-by: Philip Prindeville --- net/isc-dhcp/Makefile | 2 +- net/isc-dhcp/files/dhcpd.init | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile index d7c4a15661..81fd97681b 100644 --- a/net/isc-dhcp/Makefile +++ b/net/isc-dhcp/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=isc-dhcp UPSTREAM_NAME:=dhcp PKG_VERSION:=4.4.3-P1 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE diff --git a/net/isc-dhcp/files/dhcpd.init b/net/isc-dhcp/files/dhcpd.init index 111201009d..498cf78820 100755 --- a/net/isc-dhcp/files/dhcpd.init +++ b/net/isc-dhcp/files/dhcpd.init @@ -151,7 +151,7 @@ append_routes() { octets=$((($prefix + 7) / 8)) compacted="$(echo "$network" | cut -d. -f1-$octets)" - routes="$routes${routes:+, }$(explode "$prefix${compacted:+.$compacted}.$router")" + append routes "$(explode "$prefix${compacted:+.$compacted}.$router")" ", " } append_dhcp_options() { @@ -174,7 +174,7 @@ append_dhcp_options() { value="\"$value\"" ;; esac - formatted="$formatted${formatted:+, }$value" + append formatted "$value" ", " done echo " option $tag $formatted;" } @@ -294,17 +294,17 @@ static_host_add() { for option in $force_send; do case "$option" in hostname) - extra_options="$extra_options${extra_options:+,}0c" ;; + append extra_options "0c" "," ;; domain-name) - extra_options="$extra_options${extra_options:+,}0f" ;; + append extra_options "0f" "," ;; renewal-time) - extra_options="$extra_options${extra_options:+,}3a" ;; + append extra_options "3a" "," ;; rebinding-time) - extra_options="$extra_options${extra_options:+,}3b" ;; + append extra_options "3b" "," ;; fqdn) - extra_options="$extra_options${extra_options:+,}51" ;; + append extra_options "51" "," ;; routes) - extra_options="$extra_options${extra_options:+,}79" ;; + append extra_options "79" "," ;; *) echo "unknown option: $option" >&2 ;; esac @@ -435,7 +435,7 @@ dhcpd_add() { local octets="$(rfc1918_prefix "$subnet")" - [ -n "$octets" ] && rfc1918_nets="$rfc1918_nets${rfc1918_nets:+ }$octets" + [ -n "$octets" ] && append rfc1918_nets "$octets" [ $synthesize -eq 0 ] && return