From a657181804e0f96013b7819ef3ad28ee5955e972 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Fri, 23 Feb 2018 10:32:30 +0000 Subject: [debian] Added debian version script --- debian | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 debian diff --git a/debian b/debian new file mode 100755 index 0000000..ebde8b7 --- /dev/null +++ b/debian @@ -0,0 +1,65 @@ +#!/usr/bin/env ruby + +$map = [ + %w( buzz 1.1 ), + %w( rex 1.2 ), + %w( bo 1.3 ), + %w( hamm 2.0 2 ), + %w( slink 2.1 ), + %w( potato 2.2 ), + %w( woody 3.0 3 ), + %w( sarge 3.1 ), + %w( etch 4.0 4 ), + %w( lenny 5.0 5 ), + %w( squeeze 6.0 6 ), + %w( wheezy 7 ), + %w( jessie 8 ), + %w( stretch 9 ), + %w( buster 10 ), + %w( bullseye 11 ), + %w( sid unstable ) +] + +$stable = 9 + +def extras(keys) + if keys.include?($stable.to_s) then + return ["stable"] + elsif keys.include?(($stable-1).to_s) then + return ["oldstable"] + elsif keys.include?(($stable-1).to_s) then + return ["testing"] + elsif keys.include?(($stable-2).to_s) then + return ["oldoldstable"] + else + return [] + end +end + +def find(elem) + s = $map.select { |entry| + entry.include?(elem) + }.first + return nil if s.nil? + return s - [elem] + extras(s) +end + +if ARGV.length != 1 then + $stderr.puts "No key provided" + exit 2 +end + +key = ARGV.shift.strip.downcase + +res = find(key) + +if res.nil? then + puts "No such key" + exit 1 +end + +puts "Debian \"#{key}\":" +tab = 8 + key.length + 2 +res.each do |val| + puts "#{" "*tab}\"#{val}\"" +end -- cgit v1.2.1