confd: remap legacy dhcp client options to consolidated options

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2025-01-31 13:56:40 +01:00
parent ee44da6272
commit af8a90d651
3 changed files with 26 additions and 2 deletions
@@ -1,5 +1,6 @@
#!/bin/sh
# Rename DHCP client option attribute 'name' -> 'id' to make DHCP server.
# Rename DHCP client option attribute 'name' -> 'id'
# to match the DHCP server nomenclature.
file=$1
temp=${file}.tmp
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
# Remap DHCP client options to match DHCP server nomenclature.
file=$1
temp=${file}.tmp
jq '(
.["infix-dhcp-client:dhcp-client"]?."client-if"[]?.option[]? |=
if has("id") then
.id = ({
"subnet" : "netmask",
"dns" : "dns-server",
"ntpsrv" : "ntp-server",
"clientid" : "client-id",
"staticroutes" : "classless-static-route",
"msstaticroutes" : "ms-classless-static-route"
}[.id] // .id)
else
.
end
)' "$file" > "$temp" &&
mv "$temp" "$file"
+2 -1
View File
@@ -1,2 +1,3 @@
migratedir = $(pkgdatadir)/migrate/1.4
dist_migrate_DATA = 10-dhcp-client-option-name.sh
dist_migrate_DATA = 10-dhcp-client-option-name.sh \
20-dhcp-client-option-remap.sh