Annotation of openbsd/update_openbsd/post_dmesg_to_nycbug, Revision 1.4
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.4 ! andrew 26: print "About to post '$description', OK? ";
! 27: readline STDIN;
! 28:
1.1 andrew 29: open my $dm, '<', '/var/run/dmesg.boot' or die $!;
30: my $dmesg = do { local $/ = undef; readline $dm };
31: close $dm;
32:
33: # Remove leftover cruft from previous boots
34: $dmesg =~ s/^.*\n(OpenBSD )/$1/s;
35:
36: my $res = HTTP::Tiny->new->post_form(
37: 'http://www.nycbug.org/index.cgi',
38: { action => 'dmesgd',
39: do => 'addd',
40: nickname => 'afresh1',
41: email => 'andrew+dmesgd@afresh1.com',
42: description => $description,
43: dmesg => $dmesg,
44: }
45: );
46:
47: say $res->{success}
48: ? 'Sent dmesg'
49: : "Unable to send dmesg: $res->{status} $res->{reason}";
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>