=================================================================== RCS file: /cvs/openbsd/update_openbsd/post_dmesg_to_nycbug,v retrieving revision 1.5 retrieving revision 1.8 diff -u -r1.5 -r1.8 --- openbsd/update_openbsd/post_dmesg_to_nycbug 2015/03/03 18:56:08 1.5 +++ openbsd/update_openbsd/post_dmesg_to_nycbug 2016/10/04 06:27:00 1.8 @@ -2,12 +2,22 @@ use strict; use warnings; use feature 'say'; +use feature 'signatures'; +no warnings 'experimental::signatures'; use Sys::Hostname; use HTTP::Tiny; # This script posts your OpenBSD dmesg to the NYC*BUG dmesg archive. +sub sysctl (@s) { + open my $de, '-|', qw( sysctl -n ), @s or die $!; + my $s = join ' ', split /\s+/s, + do { local $/ = undef; readline $de }; + close $de or die $!; + return $s; +} + my $nickname = "$ENV{USER}"; my $email = "$ENV{USER}\@" . hostname(); @@ -19,12 +29,12 @@ my $description = "@ARGV"; while ( @sysctls and not $description ) { - my @s = @{ shift @sysctls }; + $description = sysctl @{ shift @sysctls }; +} - open my $de, '-|', qw( sysctl -n ), @s or die $!; - $description = join ' ', split /\s+/s, - do { local $/ = undef; readline $de }; - close $de or die $!; +if (my $version = sysctl qw( kern.version )) { + $version =~ s/\)\K.*//; + $description = "$version on $description"; } print "About to post '$description', OK? "; @@ -38,7 +48,7 @@ $dmesg =~ s/^.*\n(OpenBSD )/$1/s; my $res = HTTP::Tiny->new->post_form( - 'http://www.nycbug.org/index.cgi', + 'http://dmesgd.nycbug.org/index.cgi', { action => 'dmesgd', do => 'addd', nickname => $nickname, @@ -51,3 +61,5 @@ say $res->{success} ? 'Sent dmesg' : "Unable to send dmesg: $res->{status} $res->{reason}"; + +say $res->{content};