1

I am developing an application on qt5 using C++ which will support all popular distros, for this currently I am using QSysInfo

 qDebug() << "currentCpuArchitecture():" << QSysInfo::currentCpuArchitecture();
    qDebug() << "productType():" << QSysInfo::productType();
    qDebug() << "productVersion():" << QSysInfo::productVersion();
    qDebug() << "prettyProductName():" << QSysInfo::prettyProductName();

It returns ubuntu, manjaro... in prettyProductName, I actually need a base system like Debian, arch...

phuclv
  • 37,963
  • 15
  • 156
  • 475
Shahzain ali
  • 1,679
  • 1
  • 20
  • 33
  • Note: Qt5 is no longer open-source, If you are working under a license, no problem, but if not, you may want to migrate to Qt6. – David C. Rankin Sep 09 '22 at 07:21
  • Hi @DavidC.Rankin I have started development on qt6, but for supporting ubuntu 18.04 and for deployment I have to migrate to qt5, I am deploying using linuxdeployqt. – Shahzain ali Sep 09 '22 at 15:03
  • 1
    Okay good deal. I know the change in development and support of Qt5 by Trolltech hit a number of projects hard (KDE being one of the biggest). The Qt5 package is still available and open-source, but all future open-source development is in Qt6. Kind of a weird state of affairs. – David C. Rankin Sep 09 '22 at 21:47

1 Answers1

3

All Linux distros are just Linux so you need to read distro-specific values:

$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

The files are distro-specific and the information in those files are also distro-specific so the files and fields may differ from one distro to another. Some distro may not even have them

Similarly there's a common tool named lsb_release in most common distros and you can check its output if it exists

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:    20.04
Codename:   focal

If a rare distro doesn't have any of those then probably you're out of luck

phuclv
  • 37,963
  • 15
  • 156
  • 475
  • Yep, most `xxx-release` files were/are distro specific, but they have pretty much standardized around providing a link `/etc/os-release`. Slow but sure standardization. – David C. Rankin Sep 09 '22 at 07:25