Counting down to Ubuntu and Debian releases with distro-info

A while back I though, "wouldn't it be great if the Ubuntu release schedule could be accessed as some form of web service?" That would allow all sorts of fun scripts to be written. Yes, you could write code to parse the wiki page, but I think the technical term for that is "gross".

However, there is now a much simpler alternative in the form of distro-info. If you've never used this awesome tool written by Benjamin Drung you've been missing out! It can tell you all sorts of interesting information. A few examples...

Examples of how to use distro-info


  • What is the current development release on the system I am running on?

    $ distro-info --devel
    saucy
  • What is the current Debian development release?

    $ debian-distro-info --devel
    sid
  • What are the currently supported Ubuntu releases?

    $ ubuntu-distro-info --supported
    lucid
    precise
    quantal
    raring
    saucy
    
  • What's the latest Ubuntu LTS release?
    $ ubuntu-distro-info --lts
    precise
    
  • What's the current stable Debian release?

    $ debian-distro-info --stable
    wheezy
    

distro-info... Now with Added Milestone Goodness

I've been working with Benjamin recently to add a new feature which landed late last week in both Debian unstable and Ubuntu Saucy. So, we can now ask distro-info when a particular release milestone will happen (or has already happened):

  • How many days until Ubuntu Saucy is released?

    $ ubuntu-distro-info --devel --days
    73
  • How many days since the Ubuntu Saucy release was "created"?

    $ ubuntu-distro-info --devel --days=created
    -102
  • How many days until Ubuntu Precise goes "end-of-life" (desktop only!)

    $ ubuntu-distro-info --lts --days=eol
    1360
  • How many days since Debian sid was created?

    $ debian-distro-info --devel --days=created
    -7294

A Scripted Example

We can now write simple little scripts like this to show a popup when getting close to a release:
#!/bin/sh

set -- $(distro-info --devel --codename --days=release)

codename="$1"
days="$2"

# Only warn close to a release
[ "$days" -gt 30 ] && exit 0

zenity --info --text "$codename is released in $days days!"

Wait! Let's do that with Upstart!

In fact, you could turn the script above into an Upstart session job rather easily:
cat >>$HOME/.config/upstart/release-reminder.conf<<EOT
start on desktop-start

task
script
  set -- $(distro-info --devel --codename --days=release)

  codename="$1"
  days="$2"

  # Only warn close to a release
  [ "$days" -gt 30 ] && exit 0

  zenity --info --text "$codename is released in $days days!"
end script
EOT
Now, this script will run automatically every time you login, assuming you are running either:
The currently recognised milestones are "created", "release", "eol" and for Ubuntu LTS releases only "eol-server".

Further Ideas


We could conceivably enhance this feature further by adding in support for querying additional milestones such as "alpha-1" and "feature-freeze".

Want to know more?


For full details, read distro-info(1).



Comments

Popular posts from this blog

Byobu Bling with Unicode Custom Indicators

Procenv 0.46 - now with more platform goodness

Upstart User Sessions in Ubuntu Raring