]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
pakfire.cgi: Check for locked pakfire before trying to perform operations.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 24 May 2021 17:38:21 +0000 (19:38 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 May 2021 09:52:05 +0000 (09:52 +0000)
Fixes #12621.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/pakfire.cgi

index a9e12d23c181a39b5ee1b5813d3de920661f7ff0..faaeb4222cd31f1af92ea4354a90a90deb3d310e 100644 (file)
@@ -54,7 +54,7 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' cont
 &Header::openpage($Lang::tr{'pakfire configuration'}, 1);
 &Header::openbigbox('100%', 'left', '', $errormessage);
 
-if ($cgiparams{'ACTION'} eq 'install'){
+if (($cgiparams{'ACTION'} eq 'install') && (! -e $Pakfire::lockfile)) {
        $cgiparams{'INSPAKS'} =~ s/\|/\ /g;
        if ("$cgiparams{'FORCE'}" eq "on") {
                my $command = "/usr/local/bin/pakfire install --non-interactive --no-colors $cgiparams{'INSPAKS'} &>/dev/null &";
@@ -93,7 +93,7 @@ END
                &Header::closepage();
                exit;
        }
-} elsif ($cgiparams{'ACTION'} eq 'remove') {
+} elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e $Pakfire::lockfile)) {
 
        $cgiparams{'DELPAKS'} =~ s/\|/\ /g;
        if ("$cgiparams{'FORCE'}" eq "on") {
@@ -134,11 +134,11 @@ END
                exit;
        }
 
-} elsif ($cgiparams{'ACTION'} eq 'update') {
+} elsif (($cgiparams{'ACTION'} eq 'update') && (! -e $Pakfire::lockfile)) {
 
        system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null &");
        system("/bin/sleep 1");
-} elsif ($cgiparams{'ACTION'} eq 'upgrade') {
+} elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e $Pakfire::lockfile)) {
        my $command = "/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null &";
        system("$command");
        system("/bin/sleep 1");
@@ -176,9 +176,7 @@ if ($errormessage) {
        &Header::closebox();
 }
 
-my $return = `pidof pakfire`;
-chomp($return);
-if ($return) {
+if (-e $Pakfire::lockfile) {
        &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" );
        print <<END;
        <table>