Search code examples
pythonlinuxshelllinux-distro

where can i find the list of all awailable outputs of "lsb_release -si" in linux?


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?


Solution

  • 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.