Skip to content

Commit

Permalink
reportinfo.go: add more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lunarlattice0 committed Oct 16, 2023
1 parent 12d5722 commit f1fbf6f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions util/reportinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This is only a prototype.
We will collect CPU flags and check for AVX, distro, kernel, flatpak, and config.
More features may be added at a later time...
Wael, if you would like to combine the file reading into a single function, that would be cool.
- lunarlattice 10/16/23
*/

Expand All @@ -19,18 +20,32 @@ import (
type SysInfo struct {
CPUFlags string
AVXAvailable bool
Distro string
Kernel string
Distro string //Done
Kernel string // Done
InFlatpak bool // Done
Config string // Done
}
func GenerateInfo(currentConfigurationPath string) (SysInfo, error){
//TODO, returns struct Sysinfo.
currentSystem := &SysInfo{}

// Get Distro
if distro, err := os.ReadFile("/etc/os-release"); err != nil {
return SysInfo{}, err
} else {
currentSystem.Distro = string(distro)
}

// Get kernel
if kernel, err := os.ReadFile("/proc/version"); err != nil {
return SysInfo{}, err
} else {
currentSystem.Kernel = string(kernel)
}

// Read the config and store
if config, err := os.ReadFile(currentConfigurationPath); err != nil {
return *currentSystem, err
return SysInfo, err
} else {
currentSystem.Config = string(config)
}
Expand Down

0 comments on commit f1fbf6f

Please sign in to comment.