fastmirror/ubuntu.go

21 lines
360 B
Go
Raw Normal View History

2024-05-22 17:06:49 +00:00
package fastmirror
import (
"fmt"
"os/exec"
"strings"
)
func isUbuntu() error {
cmd := exec.Command("lsb_release", "-is")
output, err := cmd.Output()
if err != nil {
return fmt.Errorf("failed to run lsb_release: %v", err)
}
if strings.TrimSpace(string(output)) != "Ubuntu" {
return fmt.Errorf("this program is only for Ubuntu")
}
return nil
}