Annotation of openbsd/update_openbsd/post_dmesg_to_nycbug, Revision 1.2
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:
10: open my $de, '-|', qw( sysctl -n hw.vendor hw.product hw.version ) or die $!;
11: my $description = join ' ', split /\s+/s,
12: do { local $/ = undef; readline $de };
13: close $de or die $!;
14:
1.2 ! andrew 15: # Fall back to a less useful description
! 16: unless ($description) {
! 17: open my $de, '-|', qw( sysctl -n hw.model ) or die $!;
! 18: $description = join ' ', split /\s+/s,
! 19: do { local $/ = undef; readline $de };
! 20: close $de or die $!;
! 21: }
! 22:
1.1 andrew 23: open my $dm, '<', '/var/run/dmesg.boot' or die $!;
24: my $dmesg = do { local $/ = undef; readline $dm };
25: close $dm;
26:
27: # Remove leftover cruft from previous boots
28: $dmesg =~ s/^.*\n(OpenBSD )/$1/s;
29:
30: my $res = HTTP::Tiny->new->post_form(
31: 'http://www.nycbug.org/index.cgi',
32: { action => 'dmesgd',
33: do => 'addd',
34: nickname => 'afresh1',
35: email => 'andrew+dmesgd@afresh1.com',
36: description => $description,
37: dmesg => $dmesg,
38: }
39: );
40:
41: say $res->{success}
42: ? 'Sent dmesg'
43: : "Unable to send dmesg: $res->{status} $res->{reason}";
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>