From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 3/8] pakfire.cgi: Rename %pakfiresettings to %cgiparams Date: Tue, 11 Feb 2020 14:28:48 +0000 Message-ID: <20200211142853.8561-4-michael.tremer@ipfire.org> In-Reply-To: <20200211142853.8561-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4752741910581057423==" List-Id: --===============4752741910581057423== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Michael Tremer --- html/cgi-bin/pakfire.cgi | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index 7c560bfbf..f785b2594 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -30,22 +30,23 @@ require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "/opt/pakfire/lib/functions.pl"; =20 -my %pakfiresettings=3D(); +my %cgiparams=3D(); my $errormessage =3D ''; my %color =3D (); +my %pakfiresettings =3D (); my %mainsettings =3D (); =20 &Header::showhttpheaders(); =20 -$pakfiresettings{'ACTION'} =3D ''; -$pakfiresettings{'VALID'} =3D ''; +$cgiparams{'ACTION'} =3D ''; +$cgiparams{'VALID'} =3D ''; =20 -$pakfiresettings{'INSPAKS'} =3D ''; -$pakfiresettings{'DELPAKS'} =3D ''; +$cgiparams{'INSPAKS'} =3D ''; +$cgiparams{'DELPAKS'} =3D ''; =20 sub refreshpage{&Header::openbox( 'Waiting', 1, "" );print "
3D''
$Lang::tr{'pagerefresh'}
";&Header::= closebox();} =20 -&Header::getcgihash(\%pakfiresettings); +&Header::getcgihash(\%cgiparams); =20 &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/i= nclude/colors.txt", \%color); @@ -53,17 +54,17 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, "/dev/null &"; +if ($cgiparams{'ACTION'} eq 'install'){ + $cgiparams{'INSPAKS'} =3D~ s/\|/\ /g; + if ("$cgiparams{'FORCE'}" eq "on") { + my $command =3D "/usr/local/bin/pakfire install --non-interactive --no-col= ors $cgiparams{'INSPAKS'} &>/dev/null &"; system("$command"); system("/bin/sleep 1"); } else { &Header::openbox("100%", "center", $Lang::tr{'request'}); - my @output =3D `/usr/local/bin/pakfire resolvedeps --no-colors $pakfirese= ttings{'INSPAKS'}`; + my @output =3D `/usr/local/bin/pakfire resolvedeps --no-colors $cgiparams{= 'INSPAKS'}`; print <$Lang::tr{'pakfire install package'}.$pakfire= settings{'INSPAKS'}.$Lang::tr{'pakfire possible dependency'} +
$Lang::tr{'pakfire install package'}.$cgipara= ms{'INSPAKS'}.$Lang::tr{'pakfire possible dependency'}
 END
 		foreach (@output) {
@@ -75,7 +76,7 @@ END
 		
$Lang::tr{'pakfire accept all'}
 
- + @@ -92,18 +93,18 @@ END &Header::closepage(); exit; } -} elsif ($pakfiresettings{'ACTION'} eq 'remove') { +} elsif ($cgiparams{'ACTION'} eq 'remove') { =20 - $pakfiresettings{'DELPAKS'} =3D~ s/\|/\ /g; - if ("$pakfiresettings{'FORCE'}" eq "on") { - my $command =3D "/usr/local/bin/pakfire remove --non-interactive --no-colo= rs $pakfiresettings{'DELPAKS'} &>/dev/null &"; + $cgiparams{'DELPAKS'} =3D~ s/\|/\ /g; + if ("$cgiparams{'FORCE'}" eq "on") { + my $command =3D "/usr/local/bin/pakfire remove --non-interactive --no-colo= rs $cgiparams{'DELPAKS'} &>/dev/null &"; system("$command"); system("/bin/sleep 1"); } else { &Header::openbox("100%", "center", $Lang::tr{'request'}); - my @output =3D `/usr/local/bin/pakfire resolvedeps --no-colors $pakfirese= ttings{'DELPAKS'}`; + my @output =3D `/usr/local/bin/pakfire resolvedeps --no-colors $cgiparams{= 'DELPAKS'}`; print <
$Lang::tr{'pakfire uninstall package'}.$pakfi= resettings{'DELPAKS'}.$Lang::tr{'pakfire possible dependency'} +
$Lang::tr{'pakfire uninstall package'}.$cgipa= rams{'DELPAKS'}.$Lang::tr{'pakfire possible dependency'}
 END
 		foreach (@output) {
@@ -115,7 +116,7 @@ END
 		
$Lang::tr{'pakfire accept all'}
 
- + @@ -133,15 +134,15 @@ END exit; } =20 -} elsif ($pakfiresettings{'ACTION'} eq 'update') { +} elsif ($cgiparams{'ACTION'} eq 'update') { =20 system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null &"); system("/bin/sleep 1"); -} elsif ($pakfiresettings{'ACTION'} eq 'upgrade') { +} elsif ($cgiparams{'ACTION'} eq 'upgrade') { my $command =3D "/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null = &"; system("$command"); system("/bin/sleep 1"); -} elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") { +} elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { &General::writehash("${General::swroot}/pakfire/settings", \%pakfiresetting= s); } =20 --=20 2.20.1 --===============4752741910581057423==--