feat: enable use of dhcp addresses in networkd

- change ipaddress to be optional
- add dhcp option
This commit is contained in:
2025-05-03 23:46:51 +10:00
parent 1b8f50786f
commit cfb430cba1
2 changed files with 6 additions and 1 deletions
@@ -2,6 +2,9 @@
Name=<%= @title %>
[Network]
<% if @dhcp == true -%>
DHCP=yes
<% else -%>
<% if @ipaddress && @netmask -%>
Address=<%= @ipaddress %>/<%= IPAddr.new(@netmask).to_i.to_s(2).count('1') %>
<% end -%>
@@ -14,6 +17,7 @@ DNS=<%= Array(@dns).join(' ') %>
<% if @domains -%>
Domains=<%= Array(@domains).join(' ') %>
<% end -%>
<% end -%>
<% if @bridge and @bridge != true -%>
Bridge=<%= @bridge %>
<% end -%>