Skip to content

Commit

Permalink
aii-ks: fix logging of pre and post script actions for EL7
Browse files Browse the repository at this point in the history
- Fixes #120
  • Loading branch information
jouvin committed Oct 31, 2016
1 parent ed311a2 commit e1de078
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions aii-ks/src/main/perl/ks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ sub log_action {
my @logactions;
my $drainsleep = 0;

push(@logactions, "exec >$logfile 2>&1");
push(@logactions, "2>&1");

# when changing any of the behaviour
my $consolelogging = 1; # default behaviour
Expand Down Expand Up @@ -692,13 +692,12 @@ sub log_action {
}

if ($consolelogging) {
push(@logactions, '# Make sure messages show up on the serial console',
"tail -f $logfile > /dev/console &");
push(@logactions, "tee $logfile", "tee /dev/pts/0");
}

push(@logactions,"drainsleep=$drainsleep"); # add trailing newline
push(@logactions,''); # add trailing newline
return join("\n", @logactions)
# push(@logactions,"drainsleep=$drainsleep"); # add trailing newline
# push(@logactions,''); # add trailing newline
return join(" | ", @logactions)
}

# Takes care of the pre-install script, in which the
Expand All @@ -712,6 +711,7 @@ sub pre_install_script
print <<EOF;
%pre
(
# Pre-installation script.
#
# Block devices are created here instead of using Anaconda's
Expand All @@ -721,7 +721,6 @@ sub pre_install_script
# primary, one extended and your /dev/foo4 will be silently renamed to
# /dev/foo5.
$logaction
echo 'Begin of pre section'
set -x
Expand Down Expand Up @@ -874,12 +873,12 @@ EOF
# https://bugzilla.redhat.com/show_bug.cgi?id=652417
lvm vgchange -an
echo 'End of pre section'
) $logaction
# Drain remote logger (0 if not relevant)
sleep \$drainsleep
$end
EOF

}
Expand Down Expand Up @@ -1524,9 +1523,10 @@ sub post_install_script
%post
(
# %post phase. The base system has already been installed. Let's do
# some minor changes and prepare it for being configured.
$logaction
echo 'Begin of post section'
set -x
Expand Down Expand Up @@ -1625,6 +1625,7 @@ EOF
my $end = $config->getElement(END_SCRIPT_FIELD)->getValue();
print <<EOF;
echo 'End of post section'
) $logaction
# Drain remote logger (0 if not relevant)
sleep \$drainsleep
Expand Down

0 comments on commit e1de078

Please sign in to comment.