Annotation of openbsd/update_openbsd/post_dmesg_to_nycbug, Revision 1.3
1.1 andrew 1: #!/usr/bin/perl
2: use strict;
3: use warnings;
4: use feature 'say';
5:
6: use HTTP::Tiny;
7:
8: # This script posts your OpenBSD dmesg to the NYC*BUG dmesg archive.
9:
1.3 ! andrew 10: my @sysctls = (
! 11: [qw( hw.vendor hw.product hw.version )],
! 12: [qw( hw.model )],
! 13: );
1.1 andrew 14:
1.3 ! andrew 15: my $description = "@ARGV";
! 16:
! 17: while ( @sysctls and not $description ) {
! 18: my @s = @{ shift @sysctls };
! 19:
! 20: open my $de, '-|', qw( sysctl -n ), @s or die $!;
! 21: $description = join ' ', split /\s+/s,
! 22: do { local $/ = undef; readline $de };
! 23: close $de or die $!;
1.2 andrew 24: }
25:
1.1 andrew 26: open my $dm, '<', '/var/run/dmesg.boot' or die $!;
27: my $dmesg = do { local $/ = undef; readline $dm };
28: close $dm;
29:
30: # Remove leftover cruft from previous boots
31: $dmesg =~ s/^.*\n(OpenBSD )/$1/s;
32:
33: my $res = HTTP::Tiny->new->post_form(
34: 'http://www.nycbug.org/index.cgi',
35: { action => 'dmesgd',
36: do => 'addd',
37: nickname => 'afresh1',
38: email => 'andrew+dmesgd@afresh1.com',
39: description => $description,
40: dmesg => $dmesg,
41: }
42: );
43:
44: say $res->{success}
45: ? 'Sent dmesg'
46: : "Unable to send dmesg: $res->{status} $res->{reason}";
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>