commit eb0f18651f0f698534138f8ad3c19d7166c1f6c0 from: mischa date: Mon May 08 18:40:47 2023 UTC adding DHCPD=no option again to not overwrite existing dhcpd.conf commit - 3de2ea491c0d08435b93a0dd54b604031354a061 commit + eb0f18651f0f698534138f8ad3c19d7166c1f6c0 blob - e32c195dfd690100fb312a51a655a052a465d6e3 blob + 6926cb4825e6baa2e51ba8cb5beeded6081cbaf7 --- _deploy.conf +++ _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" blob - faeb6e79e25b3f02c2a7df81cf7a341a9bd4baf6 blob + e036a10a78ec4da033398452d01cdcf87b113c53 --- cease.sh +++ 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 blob - e6ce59833f64f91bae6ccac25d3a2ba3523100b0 blob + 4ee48ee1a01804d9e8a0ecd2e458625c3d668202 --- deploy.pl +++ 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"; @@ -361,11 +363,13 @@ if (-e "$dir/_deploy.conf") { 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); blob - 8a26a7f6250dae20d7fcc5924877b8e96d8bef3d blob + 168364b5d31d19649cbfba444fff99e7bdf6985d --- launch.sh +++ 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 blob - 50a82960b4780cc1a89aae213186e7a56cd25ef0 blob + ef2282880775a48b00d0e16dabafa2387d311d9f --- relaunch.sh +++ 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