Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platformVersion on elementary OS #224

Open
cerias opened this issue Jun 29, 2016 · 6 comments
Open

platformVersion on elementary OS #224

cerias opened this issue Jun 29, 2016 · 6 comments

Comments

@cerias
Copy link

cerias commented Jun 29, 2016

Platform version and Platform Family gives different informations form psutil in python.

psutil: "elementary OS" 0.4 loki
goposutil: debian jessie

psutil tells me the truths. :)

@shirou
Copy link
Owner

shirou commented Jun 30, 2016

I think psutil has no function which can get platform information.

I don't know elementary OS but if it has /etc/debian_version, gopsutil use it. Is there other way to detect elementary OS?

@cerias
Copy link
Author

cerias commented Jun 30, 2016

Ah sorry, i used the python platform.linux_distribution function.

/etc/debian_version returns different informations than lsb_release -a so

`
~ cat /etc/debian_version

jessie/sid

~ lsb_release -a

No LSB modules are available.
Distributor ID: elementary OS
Description: elementary OS Freya
Release: 0.3.2
Codename: freya
`

@shirou
Copy link
Owner

shirou commented Jun 30, 2016

I read python source code and found it's read /etc/*[-_](release|version). So, could you tell me

  • /etc/lsb-release
  • /etc/os-release

or something and these contents? Thanks.

@cerias
Copy link
Author

cerias commented Jun 30, 2016

Nope, i think this would be enough.

@Lomanic Lomanic changed the title platformVersion elementryOS platformVersion on elementary OS Jul 17, 2019
@Lomanic
Copy link
Collaborator

Lomanic commented Jul 17, 2019

/etc/lsb-release

DISTRIB_ID=elementary
DISTRIB_RELEASE=5.0
DISTRIB_CODENAME=juno
DISTRIB_DESCRIPTION="elementary OS 5.0 Juno"

/etc/os-release

NAME="elementary OS"
VERSION="5.0 Juno"
ID=elementary
ID_LIKE=ubuntu
PRETTY_NAME="elementary OS 5.0 Juno"
VERSION_ID="5.0"
HOME_URL="https://elementary.io/"
SUPPORT_URL="https://elementary.io/support"
BUG_REPORT_URL="https://github.com/elementary/appcenter/issues/new"
PRIVACY_POLICY_URL="https://elementary.io/privacy-policy"
VERSION_CODENAME=juno
UBUNTU_CODENAME=juno

@Lomanic
Copy link
Collaborator

Lomanic commented Jul 17, 2019

WIP

diff --git a/host/host_linux.go b/host/host_linux.go
index 02ff554..b4a7795 100644
--- a/host/host_linux.go
+++ b/host/host_linux.go
@@ -261,13 +261,14 @@ func PlatformInformationWithContext(ctx context.Context) (platform string, famil
                        version = getSlackwareVersion(contents)
                }
        } else if common.PathExists(common.HostEtc("debian_version")) {
-               if lsb.ID == "Ubuntu" {
+               switch lsb.ID {
+               case "Ubuntu", "LinuxMint":
                        platform = "ubuntu"
                        version = lsb.Release
-               } else if lsb.ID == "LinuxMint" {
-                       platform = "linuxmint"
+               case "elementary":
+                       platform = "elementary" // not sure about this
                        version = lsb.Release
-               } else {
+               default:
                        if common.PathExists("/usr/bin/raspi-config") {
                                platform = "raspbian"
                        } else {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants