summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Lasseter <Nat Lasseter nathan@bytemark.co.uk>2018-02-23 10:32:30 +0000
committerNat Lasseter <Nat Lasseter nathan@bytemark.co.uk>2018-02-23 10:32:30 +0000
commita657181804e0f96013b7819ef3ad28ee5955e972 (patch)
treeb6016d39618932ff8992515ec56c93ce88afb0eb
parent4f5a438b3a581d084acb43f9d98a2af1acbd31c8 (diff)
[debian] Added debian version script
-rwxr-xr-xdebian65
1 files changed, 65 insertions, 0 deletions
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