Commit 142d741d authored by bmortier's avatar bmortier

Merge branch '1.2.2-fixes-ecolo' into '1.2.3-fixes-ecolo'

merge 1.2.2 fixes ecolo into 1.2.3-fixes-ecolo

See merge request argonaut/argonaut!111
parents c673a1b3 3cb94504
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Copyright (c) 2005,2006,2007 by Jan-Marek Glogowski <glogow@fbihome.de> # Copyright (c) 2005,2006,2007 by Jan-Marek Glogowski <glogow@fbihome.de>
# Copyright (c) 2008 by Cajus Pollmeier <pollmeier@gonicus.de> # Copyright (c) 2008 by Cajus Pollmeier <pollmeier@gonicus.de>
# Copyright (c) 2008,2009, 2010 by Jan Wenzel <wenzel@gonicus.de> # Copyright (c) 2008,2009, 2010 by Jan Wenzel <wenzel@gonicus.de>
# Copyright (C) 2011-2016 FusionDirectory project # Copyright (C) 2011-2018 FusionDirectory project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -49,25 +49,46 @@ sub get_module_info { ...@@ -49,25 +49,46 @@ sub get_module_info {
} }
sub get_module_settings { sub get_module_settings {
return argonaut_get_generic_settings( my $settings = argonaut_get_generic_settings(
'argonautFuseFAIConfig', 'argonautFuseFAIConfig',
{ {
'fai_flags' => "argonautFuseFaiFlags", 'fai_version' => "argonautFuseFaiVersion",
'nfs_root' => "argonautFuseNfsRoot", 'fai_flags' => "argonautFuseFaiFlags",
'fai4_cmdline' => "argonautFuseFai4Cmdline",
'fai5_cmdline' => "argonautFuseFai5Cmdline",
'fai_hostname' => "argonautFuseFaiForceHostname",
'fai_multiple' => "argonautFuseMultipleReleaseMode",
'nfs_root' => "argonautFuseNfsRoot",
}, },
$main::config,$main::config->{'client_ip'} $main::config,$main::config->{'client_ip'}
); );
# Default values
if (not defined $settings->{'fai_version'}) {
$settings->{'fai_version'} = 4;
}
if (not defined $settings->{'fai4_cmdline'}) {
$settings->{'fai4_cmdline'} = 'ip=dhcp root=/dev/nfs boot=live union=aufs';
}
if (not defined $settings->{'fai_hostname'}) {
$settings->{'fai_hostname'} = 'TRUE';
}
if (not defined $settings->{'fai_multiple'}) {
$settings->{'fai_multiple'} = 'FALSE';
}
return $settings;
} }
sub get_pxe_config { sub get_pxe_config {
my $class = shift; my $class = shift;
my ($filename) = shift || return; my ($filename) = shift || return;
my $settings = get_module_settings();
my $settings = get_module_settings();
my $nfs_root = $settings->{'nfs_root'}; my $nfs_root = $settings->{'nfs_root'};
my $nfs_opts = "";
my $fai_flags = $settings->{'fai_flags'}; my $fai_flags = $settings->{'fai_flags'};
my $union = "aufs";
my $mac = argonaut_get_mac_pxe($filename); my $mac = argonaut_get_mac_pxe($filename);
my $result = undef; my $result = undef;
# Search for the host to examine the FAI state # Search for the host to examine the FAI state
...@@ -75,11 +96,17 @@ sub get_pxe_config { ...@@ -75,11 +96,17 @@ sub get_pxe_config {
'FAIobject', 'FAIobject',
{ {
'status' => 'FAIstate', 'status' => 'FAIstate',
'FAIclass' => 'FAIclass',
'hostname' => 'cn', 'hostname' => 'cn',
}, },
$main::config,"(macAddress=$mac)" $main::config,"(macAddress=$mac)"
); );
if ($infos->{'FAIclass'} =~ m/^(.+) :([^ :]+)$/) {
$infos->{'profile'} = $1;
$infos->{'release'} = $2;
}
if ($infos->{'locked'}) { if ($infos->{'locked'}) {
# Locked machine: go to 'localboot' # Locked machine: go to 'localboot'
$infos->{'status'} = 'localboot'; $infos->{'status'} = 'localboot';
...@@ -116,25 +143,40 @@ sub get_pxe_config { ...@@ -116,25 +143,40 @@ sub get_pxe_config {
} }
# Get kernel and initrd from TFTP root # Get kernel and initrd from TFTP root
$infos->{'kernel'} = 'vmlinuz-install'; if ($settings->{'fai_multiple'} eq 'TRUE') {
$infos->{'cmdline'} = ' initrd=initrd.img-install'; $infos->{'kernel'} = 'vmlinuz-'.$infos->{'release'}.'-install';
$infos->{'cmdline'} = ' initrd=initrd.img-'.$infos->{'release'}.'-install';
if ($nfs_root !~ m|/$|) {
$nfs_root .= '/';
}
$nfs_root .= $infos->{'release'};
} else {
$infos->{'kernel'} = 'vmlinuz-install';
$infos->{'cmdline'} = ' initrd=initrd.img-install';
}
my $chboot_cmd; my $chboot_cmd;
my $output; my $output;
my $valid_status = 1; my $valid_status = 1;
# Set cmdline
# Add NFS options and root, if available # Add NFS options and root, if available
my $nfsroot_cmdline = (defined $nfs_root && ($nfs_root ne '')); if ($settings->{'fai_version'} < 5) {
$infos->{'cmdline'} .= " nfsroot=$nfs_root" if( $nfsroot_cmdline ); $infos->{'cmdline'} .= " nfsroot=$nfs_root";
if (defined $nfs_opts && ($nfs_opts ne '')) { $infos->{'cmdline'} .= ' '.$settings->{'fai4_cmdline'};
$infos->{'cmdline'} .= ' nfsroot=' if( ! $nfsroot_cmdline ); } else {
$infos->{'cmdline'} .= ",$nfs_opts"; $infos->{'cmdline'} .= " root=".$main::config->{'client_ip'}.":".$nfs_root;
$infos->{'cmdline'} .= ' '.$settings->{'fai5_cmdline'};
if ($settings->{'fai_hostname'} ne 'FALSE') {
$infos->{'cmdline'} .= ' HOSTNAME='.$infos->{'hostname'};
}
} }
$infos->{'cmdline'} .= " FAI_ACTION=${main::default_mode}";
if ($infos->{'status'} =~ /^(install|install-init)$/) { if ($infos->{'status'} =~ /^(install|install-init)$/) {
$infos->{'kernel'} = 'kernel '.$infos->{'kernel'}; $infos->{'kernel'} = 'kernel '.$infos->{'kernel'};
$infos->{'cmdline'} .= " ip=dhcp root=/dev/nfs boot=live union=$union" $infos->{'cmdline'} .= " FAI_FLAGS=${fai_flags}";
. " FAI_ACTION=${main::default_mode} FAI_FLAGS=${fai_flags}";
} elsif ($infos->{'status'} =~ /^(error:|installing:)/) { } elsif ($infos->{'status'} =~ /^(error:|installing:)/) {
# If we had an error, show an error message # If we had an error, show an error message
# The only difference is to install is "faierror" on cmdline # The only difference is to install is "faierror" on cmdline
...@@ -142,8 +184,7 @@ sub get_pxe_config { ...@@ -142,8 +184,7 @@ sub get_pxe_config {
$faierror .= (split( ':', $infos->{'status'} ))[1]; $faierror .= (split( ':', $infos->{'status'} ))[1];
$infos->{'kernel'} = 'kernel '.$infos->{'kernel'}; $infos->{'kernel'} = 'kernel '.$infos->{'kernel'};
$infos->{'cmdline'} .= " ip=dhcp root=/dev/nfs boot=live union=$union" $infos->{'cmdline'} .= " FAI_FLAGS=${fai_flags} faierror:${faierror}";
. " FAI_ACTION=${main::default_mode} FAI_FLAGS=${fai_flags} faierror:${faierror}";
} elsif ($infos->{'status'} eq 'softupdate') { } elsif ($infos->{'status'} eq 'softupdate') {
# Softupdate has to be run by the client, so do a localboot # Softupdate has to be run by the client, so do a localboot
$infos->{'kernel'} = 'localboot 0'; $infos->{'kernel'} = 'localboot 0';
...@@ -161,8 +202,7 @@ sub get_pxe_config { ...@@ -161,8 +202,7 @@ sub get_pxe_config {
} }
my $noreboot = join( ',', @sysflags ); my $noreboot = join( ',', @sysflags );
$infos->{'kernel'} = 'kernel '.$infos->{'kernel'}; $infos->{'kernel'} = 'kernel '.$infos->{'kernel'};
$infos->{'cmdline'} .= " ip=dhcp root=/dev/nfs boot=live union=$union" $infos->{'cmdline'} .= " FAI_FLAGS=${noreboot} ";
. " FAI_ACTION=${main::default_mode} FAI_FLAGS=${noreboot} ";
} elsif ($infos->{'status'} eq 'localboot') { } elsif ($infos->{'status'} eq 'localboot') {
$infos->{'kernel'} = 'localboot 0'; $infos->{'kernel'} = 'localboot 0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment