package cmd

import (
	"os/exec"
	"bytes"
	"strings"
	"fmt"
)

func GetLocalArchType() string {
	cmd := exec.Command("arch")
	var buf bytes.Buffer
	cmd.Stdout = &buf
	cmd.Run()
	if buf.String() != "" {
		lines := strings.Split(buf.String(),"\n")
		if len(lines) == 2 {
			return strings.Trim(lines[0]," ")
		}
		return ""
	}
	return ""
}

func GetLocalUuid() string {
	cmd := exec.Command("bash","-c","dmidecode  | grep UUID")
	var buf bytes.Buffer
	cmd.Stdout = &buf
	cmd.Run()
	fmt.Println("uuid",buf.String())
	if buf.String() != "" {
		lines := strings.Split(buf.String(),"\n")
		if len(lines) >0 {
			return strings.Trim(lines[0]," ")
		}
		return ""
	}
	return ""
}