-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Labels
Description
For Debian >= 10 distro can't get the minor version.
This worked for Debian <= 9 at least when you have the lsb-release Debian package installed with distro.version(best=True) because lsb_release -a returned the major and minor version in the Release key:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.12 (stretch)
Release: 9.12
Codename: stretch
But with Debian >= 10 the Release key from lsb_release -a only has the major version:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
For Debian >= 10 the only source for the minor version is file /etc/debian_version.
The /etc/debian_version file exists for years, even on older Debian versions, with a stable format (major.minor, with the exception that Debian <= 6 has major.minor.patch).
So maybe you can consider to parse /etc/debian_version to get the minor version.