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