2017-08-27 13:18:23 -03:00
|
|
|
// Package linux contains functions that are useful to generate linux packages.
|
|
|
|
package linux
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2020-05-26 00:48:10 -03:00
|
|
|
// Arch converts a goarch to a linux-compatible arch.
|
2017-08-27 13:18:23 -03:00
|
|
|
func Arch(key string) string {
|
2020-05-26 00:48:10 -03:00
|
|
|
// XXX: list of all linux arches: `go tool dist list | grep linux`
|
2019-03-19 21:45:34 -03:00
|
|
|
var arch = strings.TrimPrefix(key, "linux")
|
|
|
|
switch arch {
|
|
|
|
case "386":
|
2017-08-27 13:18:23 -03:00
|
|
|
return "i386"
|
2019-03-19 21:45:34 -03:00
|
|
|
case "amd64":
|
|
|
|
return "amd64"
|
2019-05-29 09:09:52 -03:00
|
|
|
case "arm5": // GOARCH + GOARM
|
2018-04-13 22:59:38 +03:00
|
|
|
return "armel"
|
2019-05-29 09:09:52 -03:00
|
|
|
case "arm6": // GOARCH + GOARM
|
|
|
|
return "armhf"
|
2019-03-19 21:45:34 -03:00
|
|
|
case "arm7": // GOARCH + GOARM
|
2017-08-27 13:18:23 -03:00
|
|
|
return "armhf"
|
2020-02-05 22:08:18 -03:00
|
|
|
default:
|
|
|
|
return arch
|
2017-08-27 13:18:23 -03:00
|
|
|
}
|
|
|
|
}
|