diff --git a/_deploy.conf b/_deploy.conf index e32c195..6926cb4 100644 --- a/_deploy.conf +++ b/_deploy.conf @@ -22,6 +22,7 @@ VMDUSERS="vmdusers" SWITCH="uplink_vlan931 uplink_vlan910" INTERFACE="veb931 veb910" # dhcpd.conf +#DHCPD="no" ROUTER="46.23.93.1" DNS="46.23.80.26" SUBNET="46.23.93.0" diff --git a/cease.sh b/cease.sh index faeb6e7..e036a10 100755 --- a/cease.sh +++ b/cease.sh @@ -43,7 +43,9 @@ if vmctl show ${1%.txt} >/dev/null 2>&1; then echo "a reset ${IPV4} ${IPV6}" remove.pl ${1} deploy.pl - rcctl restart dhcpd + if [[ -z ${DHCPD} ]]; then + rcctl restart dhcpd + fi vmctl reload fi fi diff --git a/deploy.pl b/deploy.pl index e6ce598..4ee48ee 100755 --- a/deploy.pl +++ b/deploy.pl @@ -34,6 +34,7 @@ # 2022/12/01 added: boot device net, move away from expect() # 2023/05/02 added: enable flag, allow for VMs to auto-start # 2023/05/03 added: predefined IPv6 address, gw +# 2023/05/08 added: DHCPD=no to not overwrite existing dhcpd.conf, does require config for autoinstall(8) # use 5.024; use strict; @@ -197,6 +198,7 @@ sub render_install_conf { my $jot_pass = qx(jot -rcs '' 20 46 125); chomp($jot_pass); my $_ipv4 = $vms{$vm_name}{'ipv4'} || "autoconf"; + $_ipv4 = "autoconf" if $conf{'conf'}{'DHCPD'} eq "yes"; my $_ipv4_gateway = $vms{$vm_name}{'ipv4_gw'} || $conf{'conf'}{'ROUTER'}; my $_ipv6 = $vms{$vm_name}{'ipv6'} || $conf{'conf'}{'IPV6_PREFIX'} . ":" . ($conf{'conf'}{'IPV6_START'} + $vms{$vm_name}{'vm_number'}) . "::" . ($conf{'conf'}{'IP_START'} + $vms{$vm_name}{'vm_number'}); my $_ipv6_gateway = $vms{$vm_name}{'ipv6_gw'} || $conf{'conf'}{'IPV6_PREFIX'} . ":" . ($conf{'conf'}{'IPV6_START'} + $vms{$vm_name}{'vm_number'}) . "::1"; @@ -362,10 +364,12 @@ my %vms; my @files = glob "$conf{'conf'}{'VMS'}/*.txt"; %vms = get_variables('vms', @files); +$conf{'conf'}{'DHCPD'} = "yes" if (! $conf{'conf'}{'DHCPD'}); + # run all functions #debug_parse(\%conf, \%vms); render_vm_conf(\%conf, \%vms); -render_dhcpd_conf(\%conf, \%vms); +render_dhcpd_conf(\%conf, \%vms) if $conf{'conf'}{'DHCPD'} eq "yes"; render_install_conf(\%conf, \%vms); create_accounts(\%conf, \%vms); create_img_files(\%conf, \%vms); diff --git a/launch.sh b/launch.sh index 8a26a7f..168364b 100755 --- a/launch.sh +++ b/launch.sh @@ -57,7 +57,9 @@ fi deploy.pl sleep 5 -rcctl restart dhcpd +if [[ -z ${DHCPD} ]]; then + rcctl restart dhcpd +fi vmctl reload sleep 5 @@ -87,7 +89,9 @@ echo "completed" deploy.pl sleep 5 -rcctl restart dhcpd +if [[ -z ${DHCPD} ]]; then + rcctl restart dhcpd +fi vmctl reload sleep 5 diff --git a/relaunch.sh b/relaunch.sh index 50a8296..ef22828 100755 --- a/relaunch.sh +++ b/relaunch.sh @@ -45,7 +45,9 @@ fi deploy.pl sleep 5 -rcctl restart dhcpd +if [[ -z ${DHCPD} ]]; then + rcctl restart dhcpd +fi vmctl reload sleep 5 @@ -75,7 +77,9 @@ echo "completed" deploy.pl sleep 5 -rcctl restart dhcpd +if [[ -z ${DHCPD} ]]; then + rcctl restart dhcpd +fi vmctl reload sleep 5