=================================================================== RCS file: /cvs/openbsd/update_openbsd/post_dmesg_to_nycbug,v retrieving revision 1.4 retrieving revision 1.6 diff -u -r1.4 -r1.6 --- openbsd/update_openbsd/post_dmesg_to_nycbug 2015/02/23 16:12:27 1.4 +++ openbsd/update_openbsd/post_dmesg_to_nycbug 2016/10/04 02:44:20 1.6 @@ -2,11 +2,25 @@ 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(); + my @sysctls = ( [qw( hw.vendor hw.product hw.version )], [qw( hw.model )], @@ -15,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? "; @@ -37,8 +51,8 @@ 'http://www.nycbug.org/index.cgi', { action => 'dmesgd', do => 'addd', - nickname => 'afresh1', - email => 'andrew+dmesgd@afresh1.com', + nickname => $nickname, + email => $email, description => $description, dmesg => $dmesg, }