NAME
Linux::Info::KernelRelease - parses and provide Linux kernel detailed information
VERSION
version 2.19
SYNOPSIS
Getting the current kernel information:
my $current = Linux::Info::KernelRelease->new;
Or using Linux::Info::SysInfo syntax sugar to achieve the same result:
my $sys = Linux::Info::SysInfo->new;
my $current = $sys->get_detailed_kernel;
Or using a given Linux kernel release string:
my $kernel = Linux::Info::KernelRelease->new('2.4.20-0-generic');
Now you can compare the version of both of them:
say 'Kernel was upgraded!' if ($current > $kernel);
DESCRIPTION
This module parses the Linux kernel information obtained from sources like the uname
command and others.
This make it easier to fetch each piece of information from a string and also to compare different kernels (KernelRelease
sub classes) versions, since sub classes of this class will overload operators like ">=", ">" and "<".
METHODS
new
Creates a new instance.
Optionally, it might receive the following arguments:
A string as parameter like the kernel release information from /proc/sys/kernel/osrelease.
A instance of Linux::Info::KernelSource.
The string, if defined, will always have preference to setup the version based on it and the instance passed will be ignored.
If you want to use Linux::Info::KernelSource, be sure to pass undef
as the first argument.
If none arguments are passed, a new instance of Linux::Info::KernelSource will be created, and the default locations of files to parsed will be used.
This method will also invoke the _set_proc_ver_regex
method, used to parse the string at /proc/version. Subclasses must override this method, since this class won't know how to do it.
get_raw
Returns the raw information stored, as read from /proc/sys/kernel/osrelease or passed to the new
method.
get_major
Returns from the version, returns the integer corresponding to the major number.
get_minor
Returns from the version, returns the integer corresponding to the minor number.
get_patch
From the version, returns the integer corresponding to the patch number.
get_build_datetime
Returns a string representing when the kernel was built, or undef
if not possible to parse it.
get_compiled_by
Returns a string, representing the user who compiled the kernel, or undef
if not possible to parse it.
get_gcc_version
Returns a string, representing gcc compiler version used to compile the kernel, or undef
if not possible to parse it.
get_type
Returns a string, representing the features which define the kernel type, or undef
if not possible to parse it.
SEE ALSO
https://www.unixtutorial.org/use-proc-version-to-identify-your-linux-release/
AUTHOR
Alceu Rodrigues de Freitas Junior <glasswalk3r@yahoo.com.br>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Alceu Rodrigues de Freitas Junior.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007