Skip to content

Instantly share code, notes, and snippets.

@pry0cc
Created June 17, 2014 06:36
Show Gist options
  • Save pry0cc/65e015de4ed6c11ecfb7 to your computer and use it in GitHub Desktop.
Save pry0cc/65e015de4ed6c11ecfb7 to your computer and use it in GitHub Desktop.
A Ruby script to check for the latest stable linux kernel
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url = 'https://kernel.org'
data = Nokogiri::HTML(open(url))
version_no = data.at_css("#latest_link").text.strip
local_version = `uname -r`
machine_name = `cat /etc/hostname`.chomp.capitalize
repo_version = `pacman -Ss linux-headers`[19...31]
puts "The latest linux kernel release is version #{version_no}"
puts "And your the kernel installed on #{machine_name} is #{local_version}"
puts "The latest kernel in the repo is #{repo_version}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment