* Work on anvil-manage-install-target to enable/disable dhcpd. Also to only refresh the RPM repo periodically. Fixed a bug where it always reported that the kickstart files were not updated, even when they were.
Signed-off-by: Digimer <digimer@alteeve.ca>
# NOTE: This is restricted to what is available during an anaconda install session. That is to same, bare
# NOTE: This is restricted to what is available during an anaconda install session. That is to say, bare
# minimum.
# TODO: If multiple matching drives are found (same medium and size, build an appropriate RAID array.
# TODO: in pre, wipefs on all disks to clear old LVM and DRBD data
@ -140,32 +140,42 @@ use warnings;
# Set to '1' for verbose output
my $debug = #!variable!debug!#;
### NOTE: This must be set to 'striker', 'node' or 'dr' when incorporated into a kickstart %pre script!
### NOTE: This must be set to 'striker', 'node' or 'dr'! Wither set '$type' or use the appropriate argument.
my $type = "#!variable!type!#";
if ((defined $ARGV[0]) && ((lc($ARGV[0]) eq "striker") or (lc($ARGV[0]) eq "node") or (lc($ARGV[0]) eq "dr")))
{
$type = $ARGV[0];
}
if ($type =~ /striker/i)
{
print "#!string!message_0103!#\n";
print "-=] Finding install drive(s) for a Striker dashboard.\n";
$type = "striker";
}
elsif ($type =~ /node/i)
{
print "#!string!message_0104!#\n";
print "-=] Finding install drive(s) for an Anvil! node.\n";
$type = "node";
}
elsif ($type =~ /dr/i)
{
print "#!string!message_0105!#\n";
print "-=] Finding install drive(s) for a DR (disaster recovery) host.\n";
$type = "dr";
}
else
{
print "#!string!message_0106!#\n";
print "
[ Error ] - Target type not specified!
Usage: ".$0." {striker,node,dr}
";
exit(1);
}
my $device = {};
# We might want to add HCTL (Host:Channel:Target:Lun for SCSI) and/or SUBSYSTEMS later
my $drives = {};
my $target = "";
my $lsblk = system_call("/bin/lsblk --bytes --paths --pairs --output NAME,RM,HOTPLUG,TYPE,SIZE,TRAN,ROTA");
foreach my $line (split/\n/, $lsblk)
@ -186,14 +196,30 @@ foreach my $line (split/\n/, $lsblk)
transport => $transport,
rotational => $rotational,
};
my $hr_size = hr_size($device->{$path}{size});
$device->{$path}{hr_size} = $hr_size;
if ($device->{$path}{rotational})
{
print "#!string!message_0107!#\n";
if (not $device->{$path}{transport})
{
print "Analyzing platter or virtual drive: [".$path."] of the size: [".$device->{$path}{size}." (".$device->{$path}{hr_size}.")]\n";
}
else
{
print "Analyzing platter drive: [".$path."], using the transport: [".$device->{$path}{transport}."], of the size: [".$device->{$path}{size}." (".$device->{$path}{hr_size}.")]\n";
}
}
else
{
print "#!string!message_0108!#\n";
print "Analyzing solid-state drive: [".$path."], using the transport: [".$device->{$path}{transport}."], of the size: [".$device->{$path}{size}." (".$device->{$path}{hr_size}.")]\n";
}
if (not exists $drives->{by_hr_size}{$hr_size})
{
$drives->{by_hr_size}{$hr_size} = [];
}
push @{$drives->{by_hr_size}{$hr_size}}, $path;
}
### Usage selection priority
@ -215,7 +241,7 @@ if ($type eq "striker")
}
if ($use_drive)
{
print "#!string!message_0109!#\n";
print "Selected the largest disk: [".$use_drive."], which has a capacity of: [".hr_size($device->{$use_drive}{size})."]\n";
}
}
else
@ -281,11 +307,11 @@ else
{
if ($selected_is_platter)
{
print "#!string!message_0110!#\n";
print "Selected the smallest platter drive: [".$use_drive."], which has a capacity of: [".hr_size($device->{$use_drive}{size})."]\n";
}
else
{
print "#!string!message_0111!#\n";
print "Selected the smallest solid-state drive: [".$use_drive."], which has a capacity of: [".hr_size($device->{$use_drive}{size})."] (no platter drives found)\n";
}
}
}
@ -293,7 +319,7 @@ else
# Did we find a disk to use?
if (not $use_drive)
{
print "#!string!message_0112!#\n";
print "[ Error ] - Failed to find any fixed drives (platter or USB, not removable) to install onto. Unable to proceed.\n";
exit(2);
}
@ -322,29 +348,194 @@ if ((-e "/sys/class/dmi/id/product_uuid") && (-r "/sys/class/dmi/id/product_uuid
# NOTE: This is restricted to what is available during an anaconda install session. That is to same, bare
# NOTE: This is restricted to what is available during an anaconda install session. That is to say, bare
# minimum.
# TODO: If multiple matching drives are found (same medium and size, build an appropriate RAID array.
# TODO: in pre, wipefs on all disks to clear old LVM and DRBD data
@ -20,29 +20,34 @@ use warnings;
# Set to '1' for verbose output
my $debug = 0;
### NOTE: This must be set to 'striker', 'node' or 'dr' when incorporated into a kickstart %pre script!
### NOTE: This must be set to 'striker', 'node' or 'dr'! Wither set '$type' or use the appropriate argument.
my $type = "";
if ((defined $ARGV[0]) && ((lc($ARGV[0]) eq "striker") or (lc($ARGV[0]) eq "node") or (lc($ARGV[0]) eq "dr")))
{
$type = $ARGV[0];
}
if ($type =~ /striker/i)
{
print "Finding install drive for a Striker dashboard.\n";
print "-=] Finding install drive(s) for a Striker dashboard.\n";
$type = "striker";
}
elsif ($type =~ /node/i)
{
print "Finding install drive for an Anvil! node.\n";
print "-=] Finding install drive(s) for an Anvil! node.\n";
$type = "node";
}
elsif ($type =~ /dr/i)
{
print "Finding install drive for a DR (disaster recovery) host.\n";
print "-=] Finding install drive(s) for a DR (disaster recovery) host.\n";
$type = "dr";
}
else
{
print "
Error: Target type not specified.
Be sure that '\$type' is set to 'striker', 'node' or 'dr' in the \%pre section
of the kickstart script
[ Error ] - Target type not specified!
Usage: ".$0." {striker,node,dr}
";
exit(1);
}
@ -50,6 +55,7 @@ of the kickstart script
my $device = {};
# We might want to add HCTL (Host:Channel:Target:Lun for SCSI) and/or SUBSYSTEMS later
my $drives = {};
my $target = "";
my $lsblk = system_call("/bin/lsblk --bytes --paths --pairs --output NAME,RM,HOTPLUG,TYPE,SIZE,TRAN,ROTA");
foreach my $line (split/\n/, $lsblk)
@ -70,14 +76,30 @@ foreach my $line (split/\n/, $lsblk)
transport => $transport,
rotational => $rotational,
};
my $hr_size = hr_size($device->{$path}{size});
$device->{$path}{hr_size} = $hr_size;
if ($device->{$path}{rotational})
{
print "Analyzing platter drive: [".$path."], using the transport: [".$device->{$path}{transport}."], of the size: [".$device->{$path}{size}." (".hr_size($device->{$path}{size}).")]\n";
if (not $device->{$path}{transport})
{
print "Analyzing platter or virtual drive: [".$path."] of the size: [".$device->{$path}{size}." (".$device->{$path}{hr_size}.")]\n";
}
else
{
print "Analyzing platter drive: [".$path."], using the transport: [".$device->{$path}{transport}."], of the size: [".$device->{$path}{size}." (".$device->{$path}{hr_size}.")]\n";
}
}
else
{
print "Analyzing solid-state drive: [".$path."], using the transport: [".$device->{$path}{transport}."], of the size: [".$device->{$path}{size}." (".hr_size($device->{$path}{size}).")]\n";
print "Analyzing solid-state drive: [".$path."], using the transport: [".$device->{$path}{transport}."], of the size: [".$device->{$path}{size}." (".$device->{$path}{hr_size}.")]\n";
}
if (not exists $drives->{by_hr_size}{$hr_size})
{
$drives->{by_hr_size}{$hr_size} = [];
}
push @{$drives->{by_hr_size}{$hr_size}}, $path;
}
### Usage selection priority
@ -206,28 +228,202 @@ if ((-e "/sys/class/dmi/id/product_uuid") && (-r "/sys/class/dmi/id/product_uuid
@ -498,6 +501,7 @@ The body of the file: [#!variable!file!#] does not match the new body. The file
<keyname="log_0233">There was a problem updating file: [#!variable!file!#], expected the write to return '0' but got: [#!variable!return!#]. Please check the logs for details.</key>
<keyname="log_0234">Failed to backup the file: [#!variable!source!#] to: [#!variable!destination!#]. Details may be found in the logs above.</key>
<keyname="log_0235">Not updating the local repository on this run. Use '#!variable!program!# --refresh' to force a refresh of the local repository.</key>
<keyname="log_0236">Skipping the RPM repository refresh. The next scheduled refresh will be done in: [#!variable!next_refresh!#] second(s). Use '#!variable!program!# --refresh' to force an immediate refresh.</key>
<!-- Test words. Do NOT change unless you update 't/Words.t' or tests will needlessly fail. -->
<keyname="t_0000">Test</key>
@ -727,6 +731,8 @@ The update appears to have not completed successfully. The output was:
====
</key>
<keyname="error_0046">This Striker system is not configured yet. This tool will not be available until it is.</key>
<keyname="error_0047">Failed to start the Install Target feature. Got a non-zero return code when starting: [#!data!sys::daemon::dhcpd!#] (got: [#!variable!rc!#]).</key>
<keyname="error_0048">Failed to stop the Install Target feature. Got a non-zero return code when starting: [#!data!sys::daemon::dhcpd!#] (got: [#!variable!rc!#]).</key>
<!-- These are units, words and so on used when displaying information. -->