Skip to content

Commit

Permalink
Capture env variable at startup and continue
Browse files Browse the repository at this point in the history
  • Loading branch information
atoomic committed Oct 30, 2023
1 parent e261a95 commit 35876f3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -5189,9 +5189,7 @@ sub start ($self) {
update_stage_file( { manual_reboots => 1 } );
}

if ( my $ovl_size = $ENV{LEAPP_OVL_SIZE} ) {
update_stage_file( { env => { LEAPP_OVL_SIZE => $ovl_size } } );
}
$self->_capture_env_variables(); # capture at startup

if ( $self->getopt('no-leapp') ) {
my $touchfile = PAUSE_ELEVATE_TOUCHFILE;
Expand All @@ -5210,6 +5208,15 @@ sub start ($self) {
return $self->run_service_and_notify();
}

sub _capture_env_variables ($self) {

if ( my $ovl_size = $ENV{LEAPP_OVL_SIZE} ) {
update_stage_file( { env => { LEAPP_OVL_SIZE => $ovl_size } } );
}

return;
}

# This code used to be in stage 1, but it makes more sense for it to take place before a stage has been set.
sub give_last_chance ($self) {

Expand Down Expand Up @@ -5277,6 +5284,8 @@ sub continue_elevation ($self) {
return;
}

$self->_capture_env_variables(); # capture env before restart

my $pid = fork();
LOGDIE(qq[Failed to fork: $!]) unless defined $pid;
if ($pid) {
Expand Down
15 changes: 12 additions & 3 deletions script/elevate-cpanel.PL
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,7 @@ sub start ($self) {
update_stage_file( { manual_reboots => 1 } );
}

if ( my $ovl_size = $ENV{LEAPP_OVL_SIZE} ) {
update_stage_file( { env => { LEAPP_OVL_SIZE => $ovl_size } } );
}
$self->_capture_env_variables(); # capture at startup

if ( $self->getopt('no-leapp') ) {
my $touchfile = PAUSE_ELEVATE_TOUCHFILE;
Expand All @@ -568,6 +566,15 @@ sub start ($self) {
return $self->run_service_and_notify();
}

sub _capture_env_variables ($self) {

if ( my $ovl_size = $ENV{LEAPP_OVL_SIZE} ) {
update_stage_file( { env => { LEAPP_OVL_SIZE => $ovl_size } } );
}

return;
}

# This code used to be in stage 1, but it makes more sense for it to take place before a stage has been set.
sub give_last_chance ($self) {

Expand Down Expand Up @@ -635,6 +642,8 @@ sub continue_elevation ($self) {
return;
}

$self->_capture_env_variables(); # capture env before restart

my $pid = fork();
LOGDIE(qq[Failed to fork: $!]) unless defined $pid;
if ($pid) {
Expand Down

0 comments on commit 35876f3

Please sign in to comment.