Skip to content

dev_functions_2ObtainingInfo.

Xmetalfanx edited this page Mar 31, 2023 · 2 revisions

Obtaining Information

obtainDistroInformation function called

  1. lsbReleaseInfo function called
  2. osreleaseInfo function called

lsbReleaseInfo function

  • Gets information first from lsb, lsbReleaseInfo is the function

Info gathered

  • lsbDescription: $(lsb_release -sd )

    • Seems like a "Full name"
    • examples:
    • Linux Mint 19.1 Tessa
  • lsbRelease: $(lsb_release -sr)

    • examples
    • 19.1 (for Mint 19.1 Tessa)
  • lsbCodename: $(lsb_release -sc)

    • Codename on Ubuntu
    • examples:
    • tessa (for Linux Mint 19.1)
  • lsbDistribID: $(lsb_release -si)

    • examples:
    • LinuxMint

osreleaseInfo function

  • Gets more info based on /etc/os-release, osreleaseInfo is the function

Info gathered

  • OSRELEASE_NAME:

    • code:$(awk -F= '/^NAME=/ { print $2 }' /etc/os-release | tr -d \")
    • examples:
      • "Manjaro Linux",
      • Fedora
      • (with double quotes) "Linux Mint"
  • *OSRELEASE_IDLIKE_:

    • code: $(awk -F= '/^ID_LIKE=/ { print $2 }' /etc/os-release | tr -d \" )

    • examples:

    • debian (for ubuntu)

    • ubuntu (for Linux Mint )

    • OSRELEASE_ID

      • code: $(awk -F= '/^ID=/ { print $2 }' /etc/os-release | tr -d \")
      • examples:
      • fedora
      • linuxmint
  • OSRELEASE_VERSIONID:

    • code;$(awk -F= '/^VERSION_ID=/ { print $2 }' /etc/os-release | tr -d \")
      • examples:
        • 36 # (Fedora)
        • 20.04 # (Ubuntu)
        • "19.2" (Mint .. includes double quotes)
  • OSRELEASE_VERSION

    • code:$(awk -F= '/^VERSION=/ { print $2 }' /etc/os-release | tr -d \")
    • example:
      • "19.2 (Tina)" (with DQs for Linux Mint)
  • Ubuntu specific check

    • OSRELEASE_UBUNTU_CODENAME:
    • code: $(grep "^UBUNTU_CODENAME=" /etc/os-release | cut -d '=' -f 2 | sed 's/\"//g' )
    • example:
      • focal
      • jammy
Clone this wiki locally