Open ahoneybun opened 1 month ago
I think we may want to use this crate like how osrelease is pulled:
It looks like hostnamectl
does not need root and it provides board information.
@sungsphinx I need to get it to build on 24.10 for testing on my end.
Yea it certainly has more info then we may want.
I don't know how to trim out more content @sungsphinx but this at least gets a nice starting point.
I don’t believe it has more info than what’s needed, is just the right amount imo
@edfloreshz I don't think it should show stuff like Operating System, Icon Name and Static Hostname, etc. Just motherboard related info.
@ahoneybun Maybe we could parse a json output from hostnamectl
:
hostnamectl --json={pretty or short}
@edfloreshz I don't think it should show stuff like Operating System, Icon Name and Static Hostname, etc. Just motherboard related info.
@ahoneybun Maybe we could parse a json output from
hostnamectl
:hostnamectl --json={pretty or short}
aaronh@pop-os:~$ hostnamectl --json=pretty
{
"Hostname" : "pop-os",
"StaticHostname" : "pop-os",
"PrettyHostname" : null,
"DefaultHostname" : "localhost",
"HostnameSource" : "static",
"IconName" : "computer-desktop",
"Chassis" : "desktop",
"Deployment" : null,
"Location" : null,
"KernelName" : "Linux",
"KernelRelease" : "6.9.3-76060903-generic",
"KernelVersion" : "#202405300957~1728589823~24.04~3d61696 SMP PREEMPT_DYNAMIC Thu O",
"OperatingSystemPrettyName" : "Pop!_OS 24.04 LTS",
"OperatingSystemCPEName" : null,
"OperatingSystemHomeURL" : "https://pop.system76.com",
"HardwareVendor" : "System76",
"HardwareModel" : "Thelio",
"HardwareSerial" : null,
"FirmwareVersion" : "F15a Z5",
"FirmwareVendor" : "System76",
"FirmwareDate" : 1582156800000000,
"MachineID" : "dfcbb39e233116762e17fd0666578a76",
"BootID" : "7b5f89cae03a4b63aa7cf84a74e2c982",
"ProductUUID" : null
}
aaronh@pop-os:~$ hostnamectl --json=short
{"Hostname":"pop-os","StaticHostname":"pop-os","PrettyHostname":null,"DefaultHostname":"localhost","HostnameSource":"static","IconName":"computer-desktop","Chassis":"desktop","Deployment":null,"Location":null,"KernelName":"Linux","KernelRelease":"6.9.3-76060903-generic","KernelVersion":"#202405300957~1728589823~24.04~3d61696 SMP PREEMPT_DYNAMIC Thu O","OperatingSystemPrettyName":"Pop!_OS 24.04 LTS","OperatingSystemCPEName":null,"OperatingSystemHomeURL":"https://pop.system76.com","HardwareVendor":"System76","HardwareModel":"Thelio","HardwareSerial":null,"FirmwareVersion":"F15a Z5","FirmwareVendor":"System76","FirmwareDate":1582156800000000,"MachineID":"dfcbb39e233116762e17fd0666578a76","BootID":"7b5f89cae03a4b63aa7cf84a74e2c982","ProductUUID":null}
Should have mentioned certain only lines/blocks/whatever it is in JSON files that relate to the motherboard lol.
It looks like inxi --machine
might be better?
I can't seem to build the project though:
[2024-11-05T18:52:12Z WARN sctk_adwaita::buttons] Ignoring unknown button type:
thread 'main' panicked at src/app.rs:386:77:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2024-11-05T18:52:12Z ERROR iced_winit::platform_specific::wayland::event_loop] SCTK failed to send Control::AboutToWait. TrySendError { kind: Disconnected }
I had the same when I was attempting the Hardware Security page (#6), I think the command has a bit of a delay, and rust decides: nah I'm good thanks 1 second is too long
How about getting the JSON a de-serializing it to a struct that only contains the fields we need?
How about getting the JSON a de-serializing it to a struct that only contains the fields we need?
That's fine I just don't know how to do that, I can certainly change the output to JSON though!
Refer to this, you can read a JSON and access specific untyped values by key.
This is just WIP as it does currently error out on the page.