changed some variabled around, escaped qx() variabled

This commit is contained in:
mischa 2020-05-22 19:19:56 +02:00
parent ce2b228332
commit 0a721c1fa4
1 changed files with 11 additions and 11 deletions

View File

@ -172,8 +172,8 @@ sub render_install_conf {
if (! -e $_disk) {
my $_hostname = $vms{$vm_name}{'hostname'};
my $_pass = qx(jot -rcs '' 20 33 126);
chomp($_pass);
my $jot_pass = qx(jot -rcs '' 20 33 126);
chomp($jot_pass);
my $_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 = $conf{'conf'}{'IPV6_PREFIX'} . ":" . ($conf{'conf'}{'IPV6_START'} + $vms{$vm_name}{'vm_number'}) . "::1";
my $_username = $vms{$vm_name}{'username'};
@ -182,15 +182,15 @@ sub render_install_conf {
open my $fh_install, ">", "$_htdocs/$_mac-install.conf";
printf $fh_install "#\n# File generated by deploy.pl\n#\n";
printf $fh_install "System hostname = %s\n", $_hostname;
printf $fh_install "Password for root = %s\n", $_pass;
printf $fh_install "Password for root = %s\n", $jot_pass;
printf $fh_install "Which speed should com0 = 115200\n";
printf $fh_install "Network interfaces = vio0\n";
printf $fh_install "IPv4 address for vio0 = dhcp\n";
printf $fh_install "IPv6 address for vio0 = %s\n", $_ipv6;
printf $fh_install "IPv6 default router = %s\n", $_ipv6_gateway;
printf $fh_install "Setup a user = %s\n", $_username;
printf $fh_install "Password for user = %s\n", $_pass;
printf $fh_install "Public ssh key for user = %s %s\n", $_sshkey, $_pass;
printf $fh_install "Password for user = %s\n", $jot_pass;
printf $fh_install "Public ssh key for user = %s %s\n", $_sshkey, $jot_pass;
printf $fh_install "Which disk is the root disk = sd0\n";
printf $fh_install "What timezone are you in = Europe/Amsterdam\n";
printf $fh_install "Location of sets = http\n";
@ -240,13 +240,13 @@ sub create_accounts {
my $id = getpwnam("$_owner");
if (! $id) {
my $_pass = qx(jot -rcs '' 20 39 126);
chomp($_pass);
my $_encrypted_pass = qx(encrypt $_pass);
chomp($_encrypted_pass);
my $output = qx(/usr/sbin/useradd -m -G $_group -p "$_encrypted_pass" $_owner);
my $jot_pass = qx(jot -rcs '' 20 43 125);
chomp($jot_pass);
my $_encrypted_pass = qx(encrypt '${jot_pass}');
chomp($encrypt_pass);
my $output = qx(/usr/sbin/useradd -m -G $_group -p '${encrypt_pass}' $_owner);
open my $fh_authorized, ">>", "/home/$_owner/.ssh/authorized_keys";
printf $fh_authorized "%s %s\n", $_sshkey, $_pass;
printf $fh_authorized "%s %s\n", $_sshkey, $jot_pass;
close $fh_authorized;
printf "%16s %s account created\n", $_instance, $_owner;
}