Skip to content

Instantly share code, notes, and snippets.

@paride
Last active June 7, 2023 14:00
Show Gist options
  • Save paride/aa3888192cb5b195c26cc7380c44a12a to your computer and use it in GitHub Desktop.
Save paride/aa3888192cb5b195c26cc7380c44a12a to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
CSV=/usr/share/distro-info/ubuntu.csv
if [[ $# != 1 ]]; then
echo "Usage: $0 <series>"
echo "Example: $0 <jammy>"
exit 1
fi
generate_csv_entry_for_series() {
# Read latest entry into an array
mapfile -d, -t latest < <(tail -n1 $CSV | tr -d '\n')
new_series=$1
new_codename="${new_series^}"
new_codename="${new_codename} ${new_codename:0:1}ANIMAL"
new_created=${latest[4]}
new_release=$(date '+%Y-%m-%d' --date="$new_created + 26 week")
new_eol=$(date '+%Y-%m-%d' --date="$new_release + 39 week")
new_version=$(date '+%y.%m' --date="$new_release")
new_version_year=${new_version:0:2}
new_version_month=${new_version:3:5}
((new_version_year % 2 == 0 && new_version_month == 4)) && new_version="$new_version LTS"
echo "$new_version,$new_codename,$new_series,$new_created,$new_release,$new_eol"
}
generate_csv_entry_for_series "$1"
@paride
Copy link
Author

paride commented Jun 1, 2023

The EOL date will be wrong for LTS releases, but we don't care: this is a temporary hack for the very first days after a new cycle opens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment