* Started work on making text config files based on templates, started with the tftp 'default' file.

* Got a bit further with tools/anvil-manage-install-target.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 6 years ago
parent 317bc730ec
commit 9fe774071e
  1. 105
      html/skins/alteeve/pxe.txt
  2. 5
      notes
  3. 5
      pxe/tftpboot/pxelinux.cfg/default
  4. 70
      share/words.xml
  5. 85
      tools/anvil-manage-install-target

@ -0,0 +1,105 @@
<!-- start tftp_bios -->
# Tradional BIOS based PXE menu
#
# Notes:
# - Use the 'vmlinuz' and 'initrd.img' from the Netinstall ISO. The others don't find the NIC, so can't net
# install.
#
# Use the high-colour menu system.
default vesamenu.c32
# Time out and use the default menu option. Defined as tenths of a second.
TIMEOUT 600
# Prompt the user. Set to '1' to automatically choose the default option. This
# is really meant for files matched to MAC addresses.
PROMPT 0
# Set the boot menu to be 1024x768 with a nice background image. Be careful to
# ensure that all your user's can see this resolution! Default is 640x480.
MENU RESOLUTION 1024 768
# The background image
MENU BACKGROUND splash.jpg
MENU TITLE #!string!message_0080!#
# Below, the hash (#) character is replaced with the countdown timer. The
# '{,s}' allows for pluralizing a word and is used when the value is >= '2'.
MENU AUTOBOOT #!string!message_0081!#
MENU TABMSG #!string!message_0082!#
MENU NOTABMSG #!string!message_0083!#
# The following options set the various colours used in the menu. All possible
# options are specified except for F# help options. The colour is expressed as
# two hex characters between '00' and 'ff' for alpha, red, green and blue
# respectively (#AARRGGBB).
# Format is: MENU COLOR <Item> <ANSI Seq.> <foreground> <background> <shadow type>
MENU COLOR screen 0 #00000000 #00000000 std # background colour not covered by the splash image
MENU COLOR border 0 #bbd02724 #ee000000 std # The wire-frame border
MENU COLOR title 0 #fff2f2f2 #ee000000 std # Menu title text
MENU COLOR sel 0 #fff2f2f2 #ee000000 std # Selected menu option
MENU COLOR hotsel 0 #fffff2f2 #ee000000 std # The selected hotkey (set with ^ in MENU LABEL)
MENU COLOR unsel 0 #ffc2c2c2 #ee000000 std # Unselected menu options
MENU COLOR hotkey 0 #ffffc2c2 #ee000000 std # Unselected hotkeys (set with ^ in MENU LABEL)
MENU COLOR tabmsg 0 #c0a2a2a2 #00000000 std # Tab text
MENU COLOR timeout_msg 0 #ffc2c2c2 #00000000 std # Timout text
MENU COLOR timeout 0 #ffffc2c2 #00000000 std # Timout counter
MENU COLOR disabled 0 #80515151 #ee000000 std # Disabled menu options, including SEPARATORs
MENU COLOR cmdmark 0 #c0444444 #ee000000 std # Command line marker - The '> ' on the left when editing an option
MENU COLOR cmdline 0 #c0f2f2f2 #ee000000 std # Command line - The text being edited
# Options below haven't been tested, descriptions may be lacking.
MENU COLOR scrollbar 0 #407f7f7f #00000000 std # Scroll bar
MENU COLOR pwdborder 0 #80d02724 #20ffffff std # Password box wire-frame border
MENU COLOR pwdheader 0 #80f7f7f7 #20ffffff std # Password box header
MENU COLOR pwdentry 0 #80f2f2f2 #20ffffff std # Password entry field
MENU COLOR help 0 #c0f2f2f2 #c0000000 std # Help text, if set via 'TEXT HELP ... ENDTEXT'
### NOTE: inst.repo is the image of the install media, looks for .treeinfo
label striker
menu label #!string!message_0084!#
TEXT HELP
#!string!message_0085!#
ENDTEXT
kernel fedora28/vmlinuz
append initrd=fedora28/initrd.img root=live:#!variable!base_url!#/os/images/install.img inst.stage2=#!variable!base_url!#/os/ ip=dhcp inst.ks=#!variable!base_url!#/kickstart/striker.ks inst.sshd rd.debug
label node
menu label #!string!message_0086!#
TEXT HELP
#!string!message_0087!#
ENDTEXT
kernel fedora28/vmlinuz
append initrd=fedora28/initrd.img root=live:#!variable!base_url!#/os/images/install.img inst.stage2=#!variable!base_url!#/os/ ip=dhcp inst.ks=#!variable!base_url!#/kickstart/node.ks inst.sshd rd.debug
label node
menu label #!string!message_0088!#
TEXT HELP
#!string!message_0089!#
ENDTEXT
kernel fedora28/vmlinuz
append initrd=fedora28/initrd.img root=live:#!variable!base_url!#/os/images/install.img inst.stage2=#!variable!base_url!#/os/ ip=dhcp inst.ks=#!variable!base_url!#/kickstart/dr.ks inst.sshd rd.debug
label rescue
menu label #!string!message_0090!#
TEXT HELP
#!string!message_0091!#
ENDTEXT
kernel fedora28/vmlinuz
append initrd=fedora28initrd.img ip=dhcp root=live:#!variable!base_url!#/os/LiveOS/squashfs.img rescue
label fedora
menu label #!string!message_0092!#
TEXT HELP
#!string!message_0093!#
ENDTEXT
kernel fedora28/vmlinuz
append initrd=fedora28/initrd.img root=live:#!variable!base_url!#/os/images/install.img
label next
menu default
menu label #!string!message_0094!#
localboot 0xffff
<!-- end tftp_bios -->

@ -1,3 +1,8 @@
# Add to /etc/dnf/dnf.conf
keepcache=1
skip_if_unavailable=1
Firewall config stuff. Firewall config stuff.
==== ====
---- Files ---- Files

@ -1,8 +1,3 @@
# Add to /etc/dnf/dnf.conf
keepcache=1
skip_if_unavailable=1
# Tradional BIOS based PXE menu # Tradional BIOS based PXE menu
# #
# Useful docs; # Useful docs;

@ -126,6 +126,74 @@ NOTE: Please be patient!
</key> </key>
<key name="message_0078">Output: [#!variable!line!#].</key> <key name="message_0078">Output: [#!variable!line!#].</key>
<key name="message_0079">Error: [#!variable!line!#].</key> <key name="message_0079">Error: [#!variable!line!#].</key>
<!-- The strings below are used in the 'default' PXE menu. Entries used as option labels use '^' to indicate the hotkey, and must be unique in a given menu. -->
<key name="message_0080">Anvil! - Install Target Menu</key>
<key name="message_0081">Will boot the next device as configured in your BIOS in # second{,s}.</key>
<key name="message_0082"><![CDATA[Press the <tab> key to edit the boot parameters of the highlighted option.]]></key>
<key name="message_0083">Editing of this option is disabled.</key>
<key name="message_0084">Install a ^Striker dashboard (Fedora 28 64-bit)</key>
<!-- Keep help text wrapped within the area shown directly below for the 'help' section of PXE 'default' meny entry. -->
<!-- /-----------------------------------------------------------------------------------------------------------\ -->
<key name="message_0085">
This install will choose the largest available fixed disk (spindle or platter), remove any data from it,
repartition in and install. This is a fully automated process! Once selected, the only way to abort will be
a manual reboot on the system.
*** ALL EXISTING DATA ON SELECTED DRIVE WILL BE LOST! ***
*** THERE WILL BE NO FURTHER PROMPT! PROCEED CAREFULLY! ***
</key>
<!-- \-----------------------------------------------------------------------------------------------------------/ -->
<key name="message_0086">Install an Anvil! ^Node (Fedora 28 64-bit)</key>
<!-- Keep help text wrapped within the area shown directly below for the 'help' section of PXE 'default' meny entry. -->
<!-- /-----------------------------------------------------------------------------------------------------------\ -->
<key name="message_0087">
This install will choose the smallest available fixed rotating disk, if available. If none is found, the
smallest solid-state fixed disk will be chosen. All data will be removed, the disk repartitioned and a new OS
will be installed. This is a fully automated process! Once selected, the only way to abort will be a manual
reboot on the system.
*** ALL EXISTING DATA ON SELECTED DRIVE WILL BE LOST! ***
*** THERE WILL BE NO FURTHER PROMPT! PROCEED CAREFULLY! ***
</key>
<!-- \-----------------------------------------------------------------------------------------------------------/ -->
<key name="message_0088">Install an Anvil! ^Disaster Recover Host (Fedora 28 64-bit)</key>
<key name="message_0089">
<!-- Keep help text wrapped within the area shown directly below for the 'help' section of PXE 'default' meny entry. -->
<!-- /-----------------------------------------------------------------------------------------------------------\ -->
This install will choose the smallest available fixed rotating disk, if available. If none is found, the
smallest solid-state fixed disk will be chosen. All data will be removed, the disk repartitioned and a new OS
will be installed. This is a fully automated process! Once selected, the only way to abort will be a manual
reboot on the system.
*** ALL EXISTING DATA ON SELECTED DRIVE WILL BE LOST! ***
*** THERE WILL BE NO FURTHER PROMPT! PROCEED CAREFULLY! ***
<!-- \-----------------------------------------------------------------------------------------------------------/ -->
</key>
<key name="message_0090">Boot into a ^Rescue session</key>
<key name="message_0091">
<!-- Keep help text wrapped within the area shown directly below for the 'help' section of PXE 'default' meny entry. -->
<!-- /-----------------------------------------------------------------------------------------------------------\ -->
This will boot into a rescue shell. From there, you can access the bare hard drive on the machine to attempt
to diagnose and repair problems that might be preventing a system from booting.
No data on the target machine will be changed by this option.
</key>
<!-- \-----------------------------------------------------------------------------------------------------------/ -->
<key name="message_0092">Install ^Standard Fedora 28 64-bit Install</key>
<!-- Keep help text wrapped within the area shown directly below for the 'help' section of PXE 'default' meny entry. -->
<!-- /-----------------------------------------------------------------------------------------------------------\ -->
<key name="message_0093">
This will start a standard install of Fedora 28.
This option will not change anything on disk until and unless you choose to do so.
</key>
<!-- \-----------------------------------------------------------------------------------------------------------/ -->
<key name="message_0094">Boot from Next ^Boot Device</key>
<key name="message_0095"></key>
<key name="message_0096"></key>
<key name="message_0097"></key>
<key name="message_0098"></key>
<key name="message_0099"></key>
<!-- Log entries --> <!-- Log entries -->
<key name="log_0001">Starting: [#!variable!program!#].</key> <key name="log_0001">Starting: [#!variable!program!#].</key>
@ -605,6 +673,8 @@ The update appears to have not completed successfully. The output was:
<key name="error_0038">The TCP port: [#!variable!port!#] is not a valid.</key> <key name="error_0038">The TCP port: [#!variable!port!#] is not a valid.</key>
<key name="error_0039"><![CDATA[The password for the host was not provided by '--password-file' or in 'job_data' (as 'password=<secret>').]]></key> <key name="error_0039"><![CDATA[The password for the host was not provided by '--password-file' or in 'job_data' (as 'password=<secret>').]]></key>
<key name="error_0040">Logging out failed. The user's UUID wasn't passed and 'sys::users::user_uuid' wasn't set. Was the user already logged out?</key> <key name="error_0040">Logging out failed. The user's UUID wasn't passed and 'sys::users::user_uuid' wasn't set. Was the user already logged out?</key>
<key name="error_0041">Failed to install the Alteeve repo, unable to proceed.</key>
<key name="error_0042">No BCN IP address found. Unable to configure the install target feature yet.</key>
<!-- These are units, words and so on used when displaying information. --> <!-- These are units, words and so on used when displaying information. -->
<key name="unit_0001">Yes</key> <key name="unit_0001">Yes</key>

@ -13,6 +13,7 @@
# Exit codes; # Exit codes;
# 0 = Normal exit. # 0 = Normal exit.
# 1 = Alteeve repo not installed and not installable. # 1 = Alteeve repo not installed and not installable.
# 2 = BCN IP not found, unable to configure yet.
# #
# TODO: # TODO:
# - Support building the install target by mounting the ISO and checking /mnt/shared/incoming for needed # - Support building the install target by mounting the ISO and checking /mnt/shared/incoming for needed
@ -43,6 +44,16 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, secure =
$anvil->data->{switches}{'y'} = ""; $anvil->data->{switches}{'y'} = "";
$anvil->Get->switches; $anvil->Get->switches;
my ($os_type, $os_arch) = $anvil->System->get_os_type({debug => 2});
$anvil->data->{host_os}{os_type} = $os_type;
$anvil->data->{host_os}{os_arch} = $os_arch;
$anvil->data->{host_os}{version} = ($os_type =~ /(\d+)$/)[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"host_os::os_type" => $anvil->data->{host_os}{os_type},
"host_os::os_arch" => $anvil->data->{host_os}{os_arch},
"host_os::version" => $anvil->data->{host_os}{version},
}});
# load the list of packages; # load the list of packages;
load_packages($anvil); load_packages($anvil);
@ -50,7 +61,10 @@ load_packages($anvil);
#check_alteeve_repo($anvil); #check_alteeve_repo($anvil);
# Store the RPMs in repo directory. # Store the RPMs in repo directory.
update_install_source($anvil); #update_install_source($anvil);
# Setup PXE/tftp/dhcpd config.
setup_boot_environment($anvil);
# We're done # We're done
$anvil->nice_exit({exit_code => 0}); $anvil->nice_exit({exit_code => 0});
@ -60,24 +74,56 @@ $anvil->nice_exit({exit_code => 0});
# Private functions. # # Private functions. #
############################################################################################################# #############################################################################################################
sub check_alteeve_repo sub setup_boot_environment
{ {
my ($anvil) = @_; my ($anvil) = @_;
my ($os_type, $os_arch) = $anvil->System->get_os_type({debug => 2}); # Get my BCN IP and active OS.
my $version = ($os_type =~ /(\d+)$/)[0]; my $network = $anvil->Get->network_details();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { my $bcn_ip = "";
os_type => $os_type, foreach my $in_interface (sort {$a cmp $b} keys %{$network->{interface}})
os_arch => $os_arch, {
version => $version, $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { in_interface => $in_interface }});
}}); next if $in_interface !~ /^bcn/;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "interface::${in_interface}::ip" => $network->{interface}{$in_interface}{ip} }});
if ($anvil->Validate->is_ipv4({ip => $network->{interface}{$in_interface}{ip} }))
{
$bcn_ip = $network->{interface}{$in_interface}{ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bcn_ip => $bcn_ip }});
}
last if $bcn_ip;
}
if (not $bcn_ip)
{
# Can't set this up yet.
print $anvil->Words->string({key => "error_0042"})."\n";
$anvil->nice_exit({code => 2});
}
my $base_url = "http://".$bcn_ip."/".$anvil->data->{host_os}{os_type}."/".$anvil->data->{host_os}{os_arch};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { base_url => $base_url }});
# Setup the BIOS boot menu.
my $bios_default_file = $anvil->Template->get({file => "pxe.txt", show_name => 0, name => "tftp_bios", variables => { base_url => $base_url }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bios_default_file => $bios_default_file }});
die;
return(0);
}
sub check_alteeve_repo
{
my ($anvil) = @_;
my $repo_url = ""; my $repo_url = "";
my $repo_file = ""; my $repo_file = "";
if ($os_type eq "fedora") if ($anvil->data->{host_os}{os_type} eq "fedora")
{ {
$repo_file = "/etc/yum.repos.d/alteeve-f".$version.".repo"; $repo_file = "/etc/yum.repos.d/alteeve-f".$anvil->data->{host_os}{version}.".repo";
$repo_url = "https://alteeve.com/an-repo/f".$version."/alteeve-f".$version."-repo-latest.noarch.rpm"; $repo_url = "https://alteeve.com/an-repo/f".$anvil->data->{host_os}{version}."/alteeve-f".$anvil->data->{host_os}{version}."-repo-latest.noarch.rpm";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
repo_file => $repo_file, repo_file => $repo_file,
repo_url => $repo_url, repo_url => $repo_url,
@ -86,8 +132,8 @@ sub check_alteeve_repo
else else
{ {
### TODO: Update this when rhel8 is out ### TODO: Update this when rhel8 is out
$repo_file = "/etc/yum.repos.d/alteeve-el".$version.".repo"; $repo_file = "/etc/yum.repos.d/alteeve-el".$anvil->data->{host_os}{version}.".repo";
$repo_url = "https://alteeve.com/an-repo/el".$version."/alteeve-el".$version."-repo-latest.noarch.rpm"; $repo_url = "https://alteeve.com/an-repo/el".$anvil->data->{host_os}{version}."/alteeve-el".$anvil->data->{host_os}{version}."-repo-latest.noarch.rpm";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
repo_file => $repo_file, repo_file => $repo_file,
repo_url => $repo_url, repo_url => $repo_url,
@ -106,7 +152,8 @@ sub check_alteeve_repo
if (not -e $repo_file) if (not -e $repo_file)
{ {
# Die # Die
die "Failed to install the Alteeve repo, unable to proceed.\n"; print $anvil->Words->string({key => "error_0041"})."\n";
$anvil->nice_exit({code => 1});
} }
return(0); return(0);
@ -117,14 +164,8 @@ sub update_install_source
{ {
my ($anvil) = @_; my ($anvil) = @_;
my ($os_type, $os_arch) = $anvil->System->get_os_type({debug => 2});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
os_type => $os_type,
os_arch => $os_arch,
}});
### TODO: Make sure this path exists. ### TODO: Make sure this path exists.
my $download_path = "/var/www/html/".$os_type."/".$os_arch."/os/Packages/"; my $download_path = "/var/www/html/".$anvil->data->{host_os}{os_type}."/".$anvil->data->{host_os}{os_arch}."/os/Packages/";
my $array_size = @{$anvil->data->{packages}}; my $array_size = @{$anvil->data->{packages}};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
download_path => $download_path, download_path => $download_path,

Loading…
Cancel
Save