fastmirror/ubuntu.go

21 lines
360 B
Go

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
}