Open kshtsk opened 3 years ago
By the way the getos even incorrectly report dist version on raspberry py:
pi@uno:~/src/getos $ node test.js
{"os":"linux","dist":"Debian","release":"10","codename":"buster"}
pi@uno:~/src/getos $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Maybe check for /etc/os-release
before looking for other files?
Most of modern linux based distro use
/etc/os-release
only file and do not include lsb or distro specific files, which is the getos using.As a result the getos incorrectly detects distro as Raspbian for Ubuntu, openSUSE Tumbleweed and Leap, etc.
The os-release file already have NAME or ID variables for that purpose, for example, observe os-release for Leap:
or Tumbleweed
or Ubuntu:
or Centos:
and Raspbian:
For more details read: https://www.linux.org/docs/man5/os-release.html