From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Schantl To: development@lists.ipfire.org Subject: Re: [PATCH] pakfire.cgi: Bring back old logic for log displaying Date: Tue, 16 Nov 2021 05:47:44 +0100 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1680014664191316742==" List-Id: --===============1680014664191316742== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello Bernhard, thanks for testing and your feedback. > Reviewed-by: Bernhard Bitsch > Tested-by: Bernhard Bitsch >=20 > Okay, the old behaviour is reinstalled. Remains the problem with the=20 > page reload. I'm sorry I do not exactly understand which problem do you mean here - please provide some more details. A big thanks in advance, -Stefan >=20 > Am 15.11.2021 um 21:23 schrieb Stefan Schantl: > > Trying to get rid of the system backpipe check if a pakfire is > > running > > does not work very well. It simply makes the code more complex and > > only introduced some new problems. > >=20 > > This commit switches back to the old logic which worked well in the > > past. > >=20 > > Signed-off-by: Stefan Schantl > > --- > > =C2=A0 html/cgi-bin/pakfire.cgi | 57 +++++++---------------------------- > > ----- > > =C2=A0 1 file changed, 10 insertions(+), 47 deletions(-) > >=20 > > diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi > > index f2381f031..4d6eee284 100644 > > --- a/html/cgi-bin/pakfire.cgi > > +++ b/html/cgi-bin/pakfire.cgi > > @@ -44,8 +44,6 @@ $cgiparams{'VALID'} =3D ''; > > =C2=A0 $cgiparams{'INSPAKS'} =3D ''; > > =C2=A0 $cgiparams{'DELPAKS'} =3D ''; > > =C2=A0=20 > > -my $page_lock; > > - > > =C2=A0 sub refreshpage{&Header::openbox( 'Waiting', 1, " > equiv=3D'refresh' content=3D'1;'>" );print "
> src=3D'/images/clock.gif' alt=3D'' />
> color=3D'red'>$Lang::tr{'pagerefresh'}
";&Header::clos > > ebox();} > > =C2=A0=20 > > =C2=A0 &Header::getcgihash(\%cgiparams); > > @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, > > " > =C2=A0 if (($cgiparams{'ACTION'} eq 'install') && (! -e > > $Pakfire::lockfile)) { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my @pkgs =3D split(/\|/, = $cgiparams{'INSPAKS'}); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ("$cgiparams{'FORCE'}"= eq "on") { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0# Lock the page. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0&General::system_background("/usr/local/bin/pakfire > > ", "install", "--non-interactive", "--no-colors", @pkgs); > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0sleep(1); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0&Header::openbox("100%", "center", > > $Lang::tr{'request'}); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0my @output =3D > > &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "- > > -no-colors", @pkgs); > > @@ -98,9 +95,8 @@ END > > =C2=A0 } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e > > $Pakfire::lockfile)) { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my @pkgs =3D split(/\|/, = $cgiparams{'DELPAKS'}); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ("$cgiparams{'FORCE'}"= eq "on") { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0# Lock the page. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0&General::system_background("/usr/local/bin/pakfire > > ", "remove", "--non-interactive", "--no-colors", @pkgs); > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0sleep(1); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0&Header::openbox("100%", "center", > > $Lang::tr{'request'}); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0my @output =3D > > &General::system_output("/usr/local/bin/pakfire", "resolvedeps", "- > > -no-colors", @pkgs); > > @@ -136,13 +132,11 @@ END > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > =C2=A0=20 > > =C2=A0 } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e > > $Pakfire::lockfile)) { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Set variable to lock the pag= e. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&General::system_backgrou= nd("/usr/local/bin/pakfire", > > "update", "--force", "--no-colors"); > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > =C2=A0 } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e > > $Pakfire::lockfile)) { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Lock the page. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&General::system_backgrou= nd("/usr/local/bin/pakfire", > > "upgrade", "-y", "--no-colors"); > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > =C2=A0 } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$pakfiresettings{"TREE"} = =3D $cgiparams{"TREE"}; > > =C2=A0=20 > > @@ -156,6 +150,7 @@ END > > =C2=A0=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0# Update lists > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0&General::system_background("/usr/local/bin/pakfire > > ", "update", "--force", "--no-colors"); > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0sleep(1); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > =C2=A0 } > > =C2=A0=20 > > @@ -177,44 +172,12 @@ if ($errormessage) { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::closebox(); > > =C2=A0 } > > =C2=A0=20 > > -# Check if a page lock is required. > > -if ($page_lock) { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::openbox('Waiting', 1,= ,); > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0print < > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > - > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2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A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0$Lang::tr{'pakfire > > working'} > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
> > -END > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::closebox(); > > - > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Infinite loop to lock the pa= ge until pakfire lockfile is > > present. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0while($page_lock) { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0unless (-e $Pakfire::lockfile) { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0} else { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Release p= age lock. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0undef($page= _lock); > > - > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Break loo= p. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0last; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0} > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > - > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Perform page reload. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0print "\n"; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0exit; > > -} > > +# Check if pakfire is already running. > > +# > > +# The system backpipe command is safe, because no user input is > > computed. > > +my $pid =3D `pidof pakfire`; > > =C2=A0=20 > > -# Check if pakfire is already running. In this case a lockfile is > > present. > > -if (-e $Pakfire::lockfile) { > > +if ($pid) { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::openbox( 'Waitin= g', 1, " > content=3D'10;'>" ); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0print < > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > >=20 --===============1680014664191316742==--