public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <git@ipfire.org>
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. aa61d769b7f5eca23c7744590dfa18c1ef1d7c36
Date: Mon, 27 Aug 2018 07:35:50 +0100	[thread overview]
Message-ID: <20180827063550.DCF251081BD3@git01.ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 13835 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  aa61d769b7f5eca23c7744590dfa18c1ef1d7c36 (commit)
       via  06d55142e51b270d3f7f4e8ee69cc6260e87b3f7 (commit)
       via  e32591e7bfa07c5d72688cf37d86df0bea6740f6 (commit)
      from  973ffc2987afd070c95974bbebfd5c3973ca3db0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit aa61d769b7f5eca23c7744590dfa18c1ef1d7c36
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon Aug 27 07:34:28 2018 +0100

    core124: Ship latest pakfire changes
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 06d55142e51b270d3f7f4e8ee69cc6260e87b3f7
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon Aug 27 07:29:19 2018 +0100

    pakfire: Remove any reference to counter.py
    
    The concept has been retired a very log time ago
    and the web service only responds with 200 what ever
    it is being sent.
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit e32591e7bfa07c5d72688cf37d86df0bea6740f6
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon Aug 27 07:23:03 2018 +0100

    pakfire: Remove mirror health check
    
    This is not really necessary because pakfire will automatically
    failover to the next mirror anyways and that a mirror responds
    to an ICMP echo request doesn't necessarily mean that it can
    deliver the requested file.
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

-----------------------------------------------------------------------

Summary of changes:
 config/rootfiles/core/124/filelists/files |   3 +
 html/cgi-bin/pakfire.cgi                  |  11 ---
 src/pakfire/lib/functions.pl              | 122 ++++++++----------------------
 src/pakfire/pakfire                       |   1 -
 4 files changed, 33 insertions(+), 104 deletions(-)

Difference in files:
diff --git a/config/rootfiles/core/124/filelists/files b/config/rootfiles/core/124/filelists/files
index 7093d0de8..320d2808d 100644
--- a/config/rootfiles/core/124/filelists/files
+++ b/config/rootfiles/core/124/filelists/files
@@ -4,10 +4,13 @@ etc/rc.d/helper/aws-setup
 etc/rc.d/init.d/aws
 etc/rc.d/init.d/localnet
 etc/rc.d/init.d/partresize
+opt/pakfire/lib/functions.pl
+opt/pakfire/pakfire
 srv/web/ipfire/cgi-bin/firewall.cgi
 srv/web/ipfire/cgi-bin/fwhosts.cgi
 srv/web/ipfire/cgi-bin/ids.cgi
 srv/web/ipfire/cgi-bin/index.cgi
+srv/web/ipfire/cgi-bin/pakfire.cgi
 srv/web/ipfire/cgi-bin/vpnmain.cgi
 usr/bin/install-bootloader
 usr/local/bin/backupiso
diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi
index 143f123b7..79ff636c8 100644
--- a/html/cgi-bin/pakfire.cgi
+++ b/html/cgi-bin/pakfire.cgi
@@ -43,7 +43,6 @@ $pakfiresettings{'VALID'} = '';
 $pakfiresettings{'INSPAKS'} = '';
 $pakfiresettings{'DELPAKS'} = '';
 $pakfiresettings{'AUTOUPDATE'} = 'off';
-$pakfiresettings{'HEALTHCHECK'} = 'on';
 $pakfiresettings{'UUID'} = 'on';
 
 sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();}
@@ -163,9 +162,6 @@ my %checked=();
 $checked{'AUTOUPDATE'}{'off'} = '';
 $checked{'AUTOUPDATE'}{'on'} = '';
 $checked{'AUTOUPDATE'}{$pakfiresettings{'AUTOUPDATE'}} = "checked='checked'";
-$checked{'HEALTHCHECK'}{'off'} = '';
-$checked{'HEALTHCHECK'}{'on'} = '';
-$checked{'HEALTHCHECK'}{$pakfiresettings{'HEALTHCHECK'}} = "checked='checked'";
 $checked{'UUID'}{'off'} = '';
 $checked{'UUID'}{'on'} = '';
 $checked{'UUID'}{$pakfiresettings{'UUID'}} = "checked='checked'";
@@ -292,13 +288,6 @@ print <<END;
 			<tr><td align='left' width='45%'>$Lang::tr{'pakfire update daily'}</td><td width="55%" align="left">
           on <input type='radio' name='AUTOUPDATE' value='on' $checked{'AUTOUPDATE'}{'on'} /> |
           <input type='radio' name='AUTOUPDATE' value='off' $checked{'AUTOUPDATE'}{'off'} /> off </td></tr>
-			<tr><td align='left' width='45%'>$Lang::tr{'pakfire health check'}</td><td align="left">
-          on <input type='radio' name='HEALTHCHECK' value='on' $checked{'HEALTHCHECK'}{'on'} /> |
-          <input type='radio' name='HEALTHCHECK' value='off' $checked{'HEALTHCHECK'}{'off'} /> off </td></tr>          
-			<tr><td align='left' width='45%'>$Lang::tr{'pakfire register'}</td><td align="left">
-          on <input type='radio' name='UUID' value='on' $checked{'UUID'}{'on'} /> |
-          <input type='radio' name='UUID' value='off' $checked{'UUID'}{'off'} /> off </td></tr>
-			<tr><td colspan="2" align="center"><input type="submit" name="ACTION" value="$Lang::tr{'save'}" /></td></tr>
 		</table>
 	</form>
 END
diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl
index dd4007a44..12a405bd7 100644
--- a/src/pakfire/lib/functions.pl
+++ b/src/pakfire/lib/functions.pl
@@ -118,20 +118,6 @@ sub usage {
   exit 1;
 }
 
-sub pinghost {
-	my $host = shift;
-	
-	$p = Net::Ping->new("icmp");
-  if ($p->ping($host)) {
- 	 logger("PING INFO: $host is alive");
-  	return 1;
-  } else {
-		logger("PING INFO: $host is unreachable");
-		return 0;
-	}
-  $p->close();
-}
-
 sub fetchfile {
 	my $getfile = shift;
 	my $gethost = shift;
@@ -141,7 +127,7 @@ sub fetchfile {
 	use File::Basename;
 	$bfile = basename("$getfile");
 	
-	logger("DOWNLOAD STARTED: $getfile") unless ($bfile =~ /^counter\?.*/);
+	logger("DOWNLOAD STARTED: $getfile");
 
 	$i = 0;	
 	while (($allok == 0) && $i < 5) {
@@ -159,9 +145,7 @@ sub fetchfile {
 		
 		$proto = "HTTP" unless $proto;
 		
-		unless ($bfile =~ /^counter\?.*/) {
-			logger("DOWNLOAD INFO: Host: $host ($proto) - File: $file");
-		}
+		logger("DOWNLOAD INFO: Host: $host ($proto) - File: $file");
 
 		my $ua = LWP::UserAgent->new;
 		$ua->agent("Pakfire/$Conf::version");
@@ -171,10 +155,10 @@ sub fetchfile {
 		&General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings);
 
 		if ($proxysettings{'UPSTREAM_PROXY'}) {
-			logger("DOWNLOAD INFO: Upstream proxy: \"$proxysettings{'UPSTREAM_PROXY'}\"") unless ($bfile =~ /^counter.py\?.*/); 
+			logger("DOWNLOAD INFO: Upstream proxy: \"$proxysettings{'UPSTREAM_PROXY'}\"");
 			if ($proxysettings{'UPSTREAM_USER'}) {
 				$ua->proxy([["http", "https"] => "http://$proxysettings{'UPSTREAM_USER'}:$proxysettings{'UPSTREAM_PASSWORD'}@"."$proxysettings{'UPSTREAM_PROXY'}/"]);
-				logger("DOWNLOAD INFO: Logging in with: \"$proxysettings{'UPSTREAM_USER'}\" - \"$proxysettings{'UPSTREAM_PASSWORD'}\"") unless ($bfile =~ /^counter.py\?.*/);
+				logger("DOWNLOAD INFO: Logging in with: \"$proxysettings{'UPSTREAM_USER'}\" - \"$proxysettings{'UPSTREAM_PASSWORD'}\"");
 			} else {
 				$ua->proxy([["http", "https"] => "http://$proxysettings{'UPSTREAM_PROXY'}/"]);
 			}
@@ -193,19 +177,13 @@ sub fetchfile {
 			}
 		}
 
-		my $response;
+		my $result = $ua->head($url);
+		my $remote_headers = $result->headers;
+		$total_size = $remote_headers->content_length;
+		logger("DOWNLOAD INFO: $file has size of $total_size bytes");
 		
-		unless ($bfile =~ /^counter.py\?.*/) {
-			my $result = $ua->head($url);
-			my $remote_headers = $result->headers;
-			$total_size = $remote_headers->content_length;
-			logger("DOWNLOAD INFO: $file has size of $total_size bytes");
-			
-			$response = $ua->get($url, ':content_cb' => \&callback );
-			message("");
-		} else {
-			$response = $ua->get($url);
-		}
+		my $response = $ua->get($url, ':content_cb' => \&callback );
+		message("");
 		
 		my $code = $response->code();
 		my $log = $response->status_line;
@@ -217,31 +195,27 @@ sub fetchfile {
 		}
 		
 		if ($response->is_success) {
-			unless ($bfile =~ /^counter.py\?.*/) {
-				if (open(FILE, ">$Conf::tmpdir/$bfile")) {
-					print FILE $final_data;
-					close(FILE);
-					logger("DOWNLOAD INFO: File received. Start checking signature...");
-					if (&valid_signature("$Conf::tmpdir/$bfile")) {
-						logger("DOWNLOAD INFO: Signature of $bfile is fine.");
-						move("$Conf::tmpdir/$bfile","$Conf::cachedir/$bfile");
-					} else {
-						message("DOWNLOAD ERROR: The downloaded file ($file) wasn't verified by IPFire.org. Sorry - Exiting...");
-						my $ntp = `ntpdate -q -t 10 pool.ntp.org 2>/dev/null | tail -1`;
-						if ( $ntp !~ /time\ server(.*)offset(.*)/ ){message("TIME ERROR: Unable to get the nettime, this may lead to the verification error.");}
-						else { $ntp =~ /time\ server(.*)offset(.*)/; message("TIME INFO: Time Server$1has$2 offset to localtime.");}
-						exit 1;
-					}
-					logger("DOWNLOAD FINISHED: $file");
-					$allok = 1;
-					return 0;
+			if (open(FILE, ">$Conf::tmpdir/$bfile")) {
+				print FILE $final_data;
+				close(FILE);
+				logger("DOWNLOAD INFO: File received. Start checking signature...");
+				if (&valid_signature("$Conf::tmpdir/$bfile")) {
+					logger("DOWNLOAD INFO: Signature of $bfile is fine.");
+					move("$Conf::tmpdir/$bfile","$Conf::cachedir/$bfile");
 				} else {
-					logger("DOWNLOAD ERROR: Could not open $Conf::tmpdir/$bfile for writing.");
+					message("DOWNLOAD ERROR: The downloaded file ($file) wasn't verified by IPFire.org. Sorry - Exiting...");
+					my $ntp = `ntpdate -q -t 10 pool.ntp.org 2>/dev/null | tail -1`;
+					if ( $ntp !~ /time\ server(.*)offset(.*)/ ){message("TIME ERROR: Unable to get the nettime, this may lead to the verification error.");}
+					else { $ntp =~ /time\ server(.*)offset(.*)/; message("TIME INFO: Time Server$1has$2 offset to localtime.");}
+					exit 1;
 				}
-			} else {
+				logger("DOWNLOAD FINISHED: $file");
+				$allok = 1;
 				return 0;
+			} else {
+				logger("DOWNLOAD ERROR: Could not open $Conf::tmpdir/$bfile for writing.");
 			}
-		}	else {
+		} else {
 			logger("DOWNLOAD ERROR: $log");
 		}
 	}
@@ -349,10 +323,8 @@ sub selectmirror {
 	### Choose a random server and test if it is online
 	#   If the check fails try a new server.
 	#   This will never give up.
-	my $found = 0;
 	my $servers = 0;
-	my $pingdelay = 1;
-	while ($found == 0) {
+	while (1) {
 		$server = int(rand($scount) + 1);
 		$servers = 0;
 		my ($line, $proto, $path, $host);
@@ -364,22 +336,8 @@ sub selectmirror {
 				$proto = $templine[0];
 				$host = $templine[1];
 				$path = $templine[2];
-				if ($pakfiresettings{'HEALTHCHECK'} eq "off") {
-				 	logger("PING INFO: Healthcheck is disabled");
-					$found = 1;
-					return ($proto, $host, $path);
-				}
-				elsif (pinghost("$host")) {
-					$found = 1;
-					return ($proto, $host, $path);
-				}
-				if ($found == 0) {
-					sleep($pingdelay);
-					$pingdelay=$pingdelay*2;
-					if ($pingdelay>1200) {
-						$pingdelay=1200;
-					}
-				}
+
+				return ($proto, $host, $path);
 			}
 		}
 	}
@@ -789,9 +747,6 @@ sub setuppak {
 	message("PAKFIRE INST: $pak: Copying files and running post-installation scripts...");
 	my $return = system("cd $Conf::tmpdir && NAME=$pak ./install.sh >> $Conf::logdir/install-$pak.log 2>&1");
 	$return %= 255;
-	if ($pakfiresettings{'UUID'} ne "off") {
-		fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid&ipak=$pak&return=$return", "$Conf::mainserver");
-	}
 	if ($return == 0) {
 	  move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
 	  cleanup("tmp");
@@ -850,9 +805,6 @@ sub upgradepak {
 	message("PAKFIRE UPGR: $pak: Upgrading files and running post-upgrading scripts...");
 	my $return = system("cd $Conf::tmpdir && NAME=$pak ./update.sh >> $Conf::logdir/update-$pak.log 2>&1");
 	$return %= 255;
-	if ($pakfiresettings{'UUID'} ne "off") {
-		fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid&upak=$pak&return=$return", "$Conf::mainserver");
-	}
 	if ($return == 0) {
 	  move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
 	  cleanup("tmp");
@@ -875,9 +827,6 @@ sub removepak {
 	message("PAKFIRE REMV: $pak: Removing files and running post-removing scripts...");
 	my $return = system("cd $Conf::tmpdir && NAME=$pak ./uninstall.sh >> $Conf::logdir/uninstall-$pak.log 2>&1");
 	$return %= 255;
-	if ($pakfiresettings{'UUID'} ne "off") {
-		fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid&dpak=$pak&return=$return", "$Conf::mainserver");
-	}
 	if ($return == 0) {
 	  unlink("$Conf::dbdir/rootfiles/$pak");
 	  unlink("$Conf::dbdir/installed/meta-$pak");
@@ -924,17 +873,6 @@ sub makeuuid {
 	}
 }
 
-sub senduuid {
-	if ($pakfiresettings{'UUID'} ne "off") {
-		unless("$Conf::uuid") {
-			$Conf::uuid = `cat $Conf::dbdir/uuid`;
-		}
-		logger("Sending my uuid: $Conf::uuid");
-		fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid", "$Conf::mainserver");
-		system("rm -f $Conf::tmpdir/counter* 2>/dev/null");
-	}
-}
-
 sub callback {
    my ($data, $response, $protocol) = @_;
    $final_data .= $data;
diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire
index dfba91556..041ba669a 100644
--- a/src/pakfire/pakfire
+++ b/src/pakfire/pakfire
@@ -249,7 +249,6 @@
 	
 	} elsif ("$ARGV[0]" eq "update") {
 		&Pakfire::makeuuid();
-		&Pakfire::senduuid();
 		&Pakfire::getmirrors("$force");
 		&Pakfire::dbgetlist("$force");
 		&Pakfire::getcoredb("$force");


hooks/post-receive
--
IPFire 2.x development tree

                 reply	other threads:[~2018-08-27  6:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180827063550.DCF251081BD3@git01.ipfire.org \
    --to=git@ipfire.org \
    --cc=ipfire-scm@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox