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