From 0c62ba782ad3d41a7100e40620627c4fb6fe47e4 Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Sun, 16 Oct 2022 13:13:36 +0200 Subject: [PATCH] Create check_release_info --- release-info/check_release_info | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 release-info/check_release_info diff --git a/release-info/check_release_info b/release-info/check_release_info new file mode 100644 index 0000000..4ed11be --- /dev/null +++ b/release-info/check_release_info @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import subprocess + +ok_list = ['bullseye', 'bookworm', 'trixie', 'forky', 'jammy', 'focal'] +warn_list = ['buster', 'bionic', 'xenial'] + +cmd = ["/usr/bin/lsb_release", "-ircs"] +stdout, stderr = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate() +dist, version, codename, null = stdout.decode('utf-8').split('\n') + +state: int = 0 if codename in ok_list else (1 if codename in warn_list else 2) + +print (f'{state} "Distribution Info" - {dist} {version} {codename}')