[BACK]Return to post_dmesg_to_nycbug CVS log [TXT][DIR] Up to [local] / openbsd / update_openbsd

Diff for /openbsd/update_openbsd/post_dmesg_to_nycbug between version 1.2 and 1.8

version 1.2, 2015/02/22 19:31:29 version 1.8, 2016/10/04 06:27:00
Line 2 
Line 2 
 use strict;  use strict;
 use warnings;  use warnings;
 use feature 'say';  use feature 'say';
   use feature 'signatures';
   no warnings 'experimental::signatures';
   
   use Sys::Hostname;
 use HTTP::Tiny;  use HTTP::Tiny;
   
 # This script posts your OpenBSD dmesg to the NYC*BUG dmesg archive.  # This script posts your OpenBSD dmesg to the NYC*BUG dmesg archive.
   
 open my $de, '-|', qw( sysctl -n hw.vendor hw.product hw.version ) or die $!;  sub sysctl (@s) {
 my $description = join ' ', split /\s+/s,      open my $de, '-|', qw( sysctl -n ), @s or die $!;
     do { local $/ = undef; readline $de };      my $s = join ' ', split /\s+/s,
 close $de or die $!;          do { local $/ = undef; readline $de };
       close $de or die $!;
       return $s;
   }
   
 # Fall back to a less useful description  my $nickname = "$ENV{USER}";
 unless ($description) {  my $email    = "$ENV{USER}\@" . hostname();
         open my $de, '-|', qw( sysctl -n hw.model ) or die $!;  
         $description = join ' ', split /\s+/s,  my @sysctls = (
             do { local $/ = undef; readline $de };      [qw( hw.vendor hw.product hw.version  )],
         close $de or die $!;      [qw( hw.model )],
   );
   
   my $description = "@ARGV";
   
   while ( @sysctls and not $description ) {
       $description = sysctl @{ shift @sysctls };
 }  }
   
   if (my $version = sysctl qw( kern.version )) {
       $version =~ s/\)\K.*//;
       $description = "$version on $description";
   }
   
   print "About to post '$description', OK? ";
   readline STDIN;
   
 open my $dm, '<', '/var/run/dmesg.boot' or die $!;  open my $dm, '<', '/var/run/dmesg.boot' or die $!;
 my $dmesg = do { local $/ = undef; readline $dm };  my $dmesg = do { local $/ = undef; readline $dm };
 close $dm;  close $dm;
Line 28 
Line 48 
 $dmesg =~ s/^.*\n(OpenBSD )/$1/s;  $dmesg =~ s/^.*\n(OpenBSD )/$1/s;
   
 my $res = HTTP::Tiny->new->post_form(  my $res = HTTP::Tiny->new->post_form(
     'http://www.nycbug.org/index.cgi',      'http://dmesgd.nycbug.org/index.cgi',
     {   action      => 'dmesgd',      {   action      => 'dmesgd',
         do          => 'addd',          do          => 'addd',
         nickname    => 'afresh1',          nickname    => $nickname,
         email       => 'andrew+dmesgd@afresh1.com',          email       => $email,
         description => $description,          description => $description,
         dmesg       => $dmesg,          dmesg       => $dmesg,
     }      }
Line 41 
Line 61 
 say $res->{success}  say $res->{success}
     ? 'Sent dmesg'      ? 'Sent dmesg'
     : "Unable to send dmesg: $res->{status} $res->{reason}";      : "Unable to send dmesg: $res->{status} $res->{reason}";
   
   say $res->{content};

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>