diff options
author | Mihai Moldovan <ionic@ionic.de> | 2016-07-01 07:26:20 +0200 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2016-07-01 07:26:20 +0200 |
commit | 16d7cf35544f495035d27b2545c00db02889d865 (patch) | |
tree | 67e15797f6a80df5d2f18ca53580e7bb411af9e2 /bin | |
parent | 3849c3d7878939110ad5eb185dde6ced1aade2ab (diff) | |
download | buildscripts-16d7cf35544f495035d27b2545c00db02889d865.tar.gz buildscripts-16d7cf35544f495035d27b2545c00db02889d865.tar.bz2 buildscripts-16d7cf35544f495035d27b2545c00db02889d865.zip |
bin/: new script ubuntu-codename-to-version.sh to map Ubuntu code names to numerical versions.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ubuntu-codename-to-version.sh | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/bin/ubuntu-codename-to-version.sh b/bin/ubuntu-codename-to-version.sh new file mode 100755 index 0000000..943e130 --- /dev/null +++ b/bin/ubuntu-codename-to-version.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Copyright (C) 2016 by Mihai Moldovan <ionic@ionic.de> +# +# This programme is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This programme is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +export PATH="${HOME}/bin:${PATH}" + +# ${CDPATH} could lead to some very nasty problems. Better unset it. +unset CDPATH + +# Takes a Debian code name and converts it into the +# corresponding numerical version. +# The result is printed as a string with a trailing newline. +# The return code is either 0, iff mapping was successful, +# or 1 if the code name is unknown and mapping failed. + +typeset -l codename +codename="${1:?"No code name provided."}" + +typeset -l -i ret="0" + +case "${codename}" in + # The first version number is actually "fake", + # but given it's a rolling release, + # we can't really do better here. + ("devel") echo "9999";; + + ("yakkety") echo "16.10";; + + ("xenial") echo "16.04";; + ("wily") echo "15.10";; + ("vivid") echo "15.04";; + ("utopic") echo "14.10";; + ("trusty") echo "14.04";; + ("saucy") echo "13.10";; + ("raring") echo "13.04";; + ("precise") echo "12.04";; + ("quantal") echo "12.10";; + ("oneiric") echo "11.10";; + ("natty") echo "11.04";; + ("maverick") echo "10.10";; + ("lucid") echo "10.04";; + ("karmic") echo "9.10";; + ("jaunty") echo "9.04";; + ("intrepid") echo "8.10";; + ("hardy") echo "8.04";; + ("gutsy") echo "7.10";; + ("feisty") echo "7.04";; + ("edgy") echo "6.10";; + ("dapper") echo "6.06";; + ("breezy") echo "5.10";; + ("hoary") echo "5.04";; + ("warty") echo "4.10";; + + (*) ret="1";; +esac + +return "${ret}" |