Revision: 7363 http://sourceforge.net/p/ipcop/svn/7363 Author: owes Date: 2014-03-23 15:29:45 +0000 (Sun, 23 Mar 2014) Log Message: ----------- Change update.cgi update mechanism. Run update in 'background' and show a box with auto-refresh as long as installpackage is running.
Modified Paths: -------------- ipcop/trunk/html/cgi-bin/updates.cgi Modified: ipcop/trunk/html/cgi-bin/updates.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/updates.cgi 2014-03-23 15:08:38 UTC (rev 7362) +++ ipcop/trunk/html/cgi-bin/updates.cgi 2014-03-23 15:29:45 UTC (rev 7363) @@ -128,14 +128,7 @@ elsif ($uploadsettings{'ACTION'} eq $Lang::tr{'apply'}) { my $filename = "ipcop-$uploadsettings{'APPLY_VERSION'}-update.${General::machine}.tgz.gpg"; &General::log("installpackage", "Apply update: ${filename}"); - $errormessage = &get_error(system("/usr/local/bin/installpackage --install=/var/patches/${filename} >/dev/null") >> 8); - if ($errormessage eq '') { - - #Hack to get correct version displayed after update - open(XX, "/usr/bin/perl -e \"require'/usr/lib/ipcop/general-functions.pl';print \\\$General::version\"|"); - $General::version = <XX>; - close(XX); - } + system("/usr/local/bin/installpackage --install=/var/patches/${filename} >/dev/null &"); } elsif (index($uploadsettings{'ACTION'}, "delete-") != -1) { my @tmp = split(/-/, $uploadsettings{'ACTION'}); @@ -174,6 +167,28 @@ &General::writehash('/var/ipcop/main/settings', \%mainsettings); } + +# In case update in progress, show box and refresh +if (! system("/bin/ps ax | /bin/grep -q [i]nstallpackage") ) { + # Temporary test for translated text as it will only become available after extracting the 2.1.3 patch file. + my $langtxt; + if (defined($Lang::tr{'ipcop will now update'})) { + $langtxt = $Lang::tr{'ipcop will now update'}; + } + else { + $langtxt = 'IPCop will now update.'; + } + &Header::page_show('title', 'warning', $langtxt, "<meta http-equiv='refresh' content='5; URL=/cgi-bin/updates.cgi' />"); + exit(0); +} + +# Check for error written by installpackage during update +if (-e '/var/patches/error') { + my $errorcode = `/bin/cat /var/patches/error`; + $errormessage .= &get_error(chomp($errorcode)); + system('rm -rf /var/patches/error'); +} + # Read-in the XML list files installed/ready to install $installed = eval { XMLin('/var/ipcop/patches/installed.xml') }; if ($@) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn