summaryrefslogtreecommitdiffstats
path: root/scripts/kernel.pl
blob: 435a0685b4707ce5a69284cd060c24d71d7e6a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Fetches the version(s) of the latest Linux kernel(s).

# /kernel

use strict;
use Irssi;
use LWP::Simple;

use vars qw($VERSION %IRSSI);

$VERSION = '0.10';
%IRSSI = (
    authors     => 'Johan "Ion" Kiviniemi',
    contact     => 'ion at hassers.org',
    name        => 'Kernel',
    description => 'Fetches the version(s) of the latest Linux kernel(s).',
    license     => 'Public Domain',
    url         => 'http://scripts.irssi.org/',
    changed     => '2018-03-11',
);

sub wget {
	my $con =get("https://www.kernel.org/finger_banner");
	return $con;
}

sub get_version {
    my @version;
    if (my $finger = wget()) {
        # The magic of the regexps :)
        @version = $finger =~ /:\s*(\S+)\s*$/gm;
        # Modify this to do whatever you want.
        Irssi::print("@version");
    }
}

Irssi::command_bind('kernel_version', 'get_version');