Last active
June 7, 2023 14:00
-
-
Save paride/aa3888192cb5b195c26cc7380c44a12a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.