adding DHCPD=no option again to not overwrite existing dhcpd.conf

master
mischa 2023-05-08 20:40:47 +02:00
parent 3de2ea491c
commit eb0f18651f
5 changed files with 21 additions and 6 deletions

View File

@ -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"

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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