From: Franck B. <fra...@us...> - 2005-07-29 02:15:28
|
Update of /cvsroot/ipcop/ipcop/html/cgi-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23953/html/cgi-bin Modified Files: Tag: IPCOP_v1_4_0 updates.cgi Log Message: Installpackage try using /var/log partition first, then root partition (as before) for the de-gnupg operation. Add 'clear squid cache' button on updates screen. Also display disk usage to help user in deciding what to do Do not need tree times the package size free on root ! Index: updates.cgi =================================================================== RCS file: /cvsroot/ipcop/ipcop/html/cgi-bin/updates.cgi,v retrieving revision 1.9.2.12 retrieving revision 1.9.2.13 diff -C2 -d -r1.9.2.12 -r1.9.2.13 *** updates.cgi 29 Jun 2005 19:28:43 -0000 1.9.2.12 --- updates.cgi 29 Jul 2005 02:14:42 -0000 1.9.2.13 *************** *** 38,62 **** &Header::getcgihash(\%uploadsettings, {'wantfile' => 1, 'filevar' => 'FH'}); ! if ($uploadsettings{'ACTION'} eq "Upload") ! { my $return = &downloadlist(); ! if ($return && $return->is_success) ! { ! if (open(LIST, ">${General::swroot}/patches/available")) ! { flock LIST, 2; my @this = split(/----START LIST----\n/,$return->content); print LIST $this[1]; close(LIST); ! } ! else ! { $errormessage = $Lang::tr{'could not open available updates file'}; } ! } ! else ! { ! if (open(LIST, "<${General::swroot}/patches/available")) ! { my @list = <LIST>; close(LIST); --- 38,54 ---- &Header::getcgihash(\%uploadsettings, {'wantfile' => 1, 'filevar' => 'FH'}); ! if ($uploadsettings{'ACTION'} eq $Lang::tr{'upload'}) { my $return = &downloadlist(); ! if ($return && $return->is_success) { ! if (open(LIST, ">${General::swroot}/patches/available")){ flock LIST, 2; my @this = split(/----START LIST----\n/,$return->content); print LIST $this[1]; close(LIST); ! } else { $errormessage = $Lang::tr{'could not open available updates file'}; } ! } else { ! if (open(LIST, "<${General::swroot}/patches/available")) { my @list = <LIST>; close(LIST); *************** *** 67,73 **** if (copy ($uploadsettings{'FH'}, "/var/patches/patch-$$.tar.gz.gpg") != 1) { $errormessage = $!; ! } ! else ! { my $exitcode = system("/usr/local/bin/installpackage $$ > /dev/null") >> 8; if ($exitcode == 0) { --- 59,63 ---- if (copy ($uploadsettings{'FH'}, "/var/patches/patch-$$.tar.gz.gpg") != 1) { $errormessage = $!; ! } else { my $exitcode = system("/usr/local/bin/installpackage $$ > /dev/null") >> 8; if ($exitcode == 0) { *************** *** 85,100 **** elsif($exitcode == 7) { $errormessage = "$Lang::tr{'this update is already installed'}"; } else { $errormessage = "$Lang::tr{'package failed to install'}"; } } - } ! elsif ($uploadsettings{'ACTION'} eq $Lang::tr{'refresh update list'}) ! { my $return = &downloadlist(); ! if ($return && $return->is_success) ! { ! if (open(LIST, ">${General::swroot}/patches/available")) ! { flock LIST, 2; my @this = split(/----START LIST----\n/,$return->content); --- 75,88 ---- elsif($exitcode == 7) { $errormessage = "$Lang::tr{'this update is already installed'}"; } + elsif($exitcode == 11) { + $errormessage = "No enought disk space"; } else { $errormessage = "$Lang::tr{'package failed to install'}"; } } } ! elsif ($uploadsettings{'ACTION'} eq $Lang::tr{'refresh update list'}) { my $return = &downloadlist(); ! if ($return && $return->is_success) { ! if (open(LIST, ">${General::swroot}/patches/available")) { flock LIST, 2; my @this = split(/----START LIST----\n/,$return->content); *************** *** 102,115 **** close(LIST); &General::log($Lang::tr{'successfully refreshed updates list'}); ! } ! else ! { $errormessage = $Lang::tr{'could not open available updates file'}; } } - else { - $errormessage = $Lang::tr{'could not download the available updates list'}; } } ! open(AV, "<${General::swroot}/patches/available") or $errormessage = $Lang::tr{'could not open available updates file'}; @av = <AV>; --- 90,104 ---- close(LIST); &General::log($Lang::tr{'successfully refreshed updates list'}); ! } else { $errormessage = $Lang::tr{'could not open available updates file'}; } + } else { + $errormessage = $Lang::tr{'could not download the available updates list'}; } } ! elsif ($uploadsettings{'ACTION'} eq "$Lang::tr{'clear cache'} (squid)") { ! system('/usr/local/bin/restartsquid','-f'); ! } ! open(AV, "<${General::swroot}/patches/available") or $errormessage = $Lang::tr{'could not open available updates file'}; @av = <AV>; *************** *** 138,165 **** } - &Header::openbox('100%', 'LEFT', $Lang::tr{'installed updates'}); - - print qq|<table width='100%' border='0' cellpadding='2' cellspacing='0'> - <tr> - <td width='5%'><b>$Lang::tr{'id'}</b></td> - <td width='15%'><b>$Lang::tr{'title'}</b></td> - <td width='50%'><b>$Lang::tr{'description'}</b></td> - <td width='15%'><b>$Lang::tr{'released'}</b></td> - <td width='15%'><b>$Lang::tr{'installed'}</b></td> - </tr> - |; - - foreach my $pf (@pf) - { - next if $pf =~ m/^#/; - my @temp = split(/\|/,$pf); - @av = grep(!/^$temp[0]/, @av); - print "<tr><td valign='top'>" . join("</td><td valign='top'>",@temp) . "</td></tr>"; - } - close(PF); - - print qq|</table>|; - - &Header::closebox(); &Header::openbox('100%', 'left', $Lang::tr{'available updates'}); --- 127,130 ---- *************** *** 181,193 **** } print "</table>"; - } - else { - print $Lang::tr{'all updates installed'}; } - - &Header::closebox(); - - &Header::openbox('100%', 'left', $Lang::tr{'install new update'}); ! print qq| $Lang::tr{'to install an update'} <br /> --- 146,151 ---- } print "</table>"; ! print qq|<hr /><br> $Lang::tr{'to install an update'} <br /> *************** *** 197,204 **** <td align='right' class='base'> <b>$Lang::tr{'upload update file'}</b></td> ! <td><input type="file" name="FH" /> <input type='submit' name='ACTION' value='Upload' /></td> </tr> ! </table> ! </form>|; &Header::closebox(); --- 155,202 ---- <td align='right' class='base'> <b>$Lang::tr{'upload update file'}</b></td> ! <td><input type="file" name="FH" /> <input type='submit' name='ACTION' value=$Lang::tr{'upload'} /> ! </td></tr> ! </table>|; ! print "<b>$Lang::tr{'disk usage'}</b>"; ! open (XX,'df -h / /var/log|'); ! my @df=<XX>; ! close (XX); ! print '<table>'; ! map ( $_ =~ s/ +/<td>/g,@df); # tablify each line! ! print "<tr><td>$df[0]</tr>"; ! print "<tr><td>$df[1]</tr>"; ! print "<tr><td>$df[2]<td><input type='submit' name='ACTION' value='$Lang::tr{'clear cache'} (squid)' /></tr>"; ! print "</table>"; ! ! print "</form>"; ! ! } else { ! print $Lang::tr{'all updates installed'}; ! } ! ! ! &Header::closebox(); ! ! &Header::openbox('100%', 'LEFT', $Lang::tr{'installed updates'}); ! ! print qq|<table width='100%' border='0' cellpadding='2' cellspacing='0'> ! <tr> ! <td width='5%'><b>$Lang::tr{'id'}</b></td> ! <td width='15%'><b>$Lang::tr{'title'}</b></td> ! <td width='50%'><b>$Lang::tr{'description'}</b></td> ! <td width='15%'><b>$Lang::tr{'released'}</b></td> ! <td width='15%'><b>$Lang::tr{'installed'}</b></td> </tr> ! |; ! ! foreach my $pf (@pf) { ! next if $pf =~ m/^#/; ! my @temp = split(/\|/,$pf); ! @av = grep(!/^$temp[0]/, @av); ! print "<tr><td valign='top'>" . join("</td><td valign='top'>",@temp) . "</td></tr>"; ! } ! close(PF); ! ! print qq|</table>|; &Header::closebox(); |