From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernhard Bitsch To: development@lists.ipfire.org Subject: Re: [PATCH] pakfire.cgi: Bring back old logic for log displaying Date: Tue, 16 Nov 2021 16:51:06 +0100 Message-ID: <8ae94ef5-399d-b827-0cdb-2d18d032c233@ipfire.org> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8877666007079120504==" List-Id: --===============8877666007079120504== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello Stefan, the logs are only displayed once ( the last 20 lines ). The aim of the change was a refreshing of this log to show the progress=20 of the pakfire function, if I remember right. I tried to implement this, but with no success. :( - Bernhard Am 16.11.2021 um 05:47 schrieb Stefan Schantl: > Hello Bernhard, >=20 > thanks for testing and your feedback. >> Reviewed-by: Bernhard Bitsch >> Tested-by: Bernhard Bitsch >> >> Okay, the old behaviour is reinstalled. Remains the problem with the >> page reload. >=20 > I'm sorry I do not exactly understand which problem do you mean here - > please provide some more details. >=20 > A big thanks in advance, >=20 > -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. >>> >>> This commit switches back to the old logic which worked well in the >>> past. >>> >>> Signed-off-by: Stefan Schantl >>> --- >>> =C2=A0 html/cgi-bin/pakfire.cgi | 57 +++++++---------------------------- >>> ----- >>> =C2=A0 1 file changed, 10 insertions(+), 47 deletions(-) >>> >>> 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 ''; >>> =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();} >>> =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} >>> =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_backgro= und("/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_backgro= und("/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"}; >>> =20 >>> @@ -156,6 +150,7 @@ END >>> =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 } >>> =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 } >>> =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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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$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`; >>> =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( 'Waiti= ng', 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 --===============8877666007079120504==--