I want to detect a person's distro in linux using python, and I want to do different things depending on a distro and I don't know where I could find such list, I googled it, but found nothing, I also ran man lsb_release
but I got nothing there, maybe anyone know where i could find such list?
Asked
Active
Viewed 248 times
-1
-
https://unix.stackexchange.com/ try asking here – pippo1980 Mar 13 '21 at 22:41
-
@pippo1980 okay – Mar 13 '21 at 22:42
-
https://unix.stackexchange.com/questions/405709/python-lsb-release-not-working-in-debian-9 first hit searching for lsb_release you can try https://askubuntu.com/ too I believe its debian_based_linux but not sure – pippo1980 Mar 13 '21 at 22:45
-
import lsb_release but apparently this module is not present in all the pythons 3, https://linuxluvr.blogspot.com/2017/05/python-module-lsbrelease.html, you could try that , I am not on linux – pippo1980 Mar 13 '21 at 22:55
1 Answers
0
lsb_release
is a shell script:
$ file $(command -v lsb_release )
/usr/bin/lsb_release: a /usr/bin/sh script, ASCII text executable
so you can open it in your editor and see what it does.
I want to do different things depending on a distro and I don't know where I could find such list
I don't think such list exists, lsb_release
just reads
/etc/lsb-release
or local /etc/[distro]-release
file, as it says
in the comment:
# Description:
# Collect informations from sourceable /etc/lsb-release file (present on
# LSB-compliant systems) : LSB_VERSION, DISTRIB_ID, DISTRIB_RELEASE,
# DISTRIB_CODENAME, DISTRIB_DESCRIPTION (all optional).
# Then (if needed) find and parse the /etc/[distro]-release file.
For example, on my Slackware system it reads /etc/lsb-release
and on
Fedora it reads /etc/redhat-release
so whatever info you put in
there will be reported.

Arkadiusz Drabczyk
- 11,227
- 2
- 25
- 38