Commit 9c50b89d by bergquist

feat(build): make build more generic for executables

parent 063b54ae
...@@ -31,7 +31,7 @@ var ( ...@@ -31,7 +31,7 @@ var (
linuxPackageIteration string = "" linuxPackageIteration string = ""
race bool race bool
workingDir string workingDir string
serverBinaryName string = "grafana-server" binaries []string = []string{"grafana-server", "grafana-cli"}
) )
const minGoVersion = 1.3 const minGoVersion = 1.3
...@@ -64,8 +64,9 @@ func main() { ...@@ -64,8 +64,9 @@ func main() {
case "build": case "build":
clean() clean()
build(serverBinaryName, "./pkg/cmd/grafana-server", []string{}) for _, binary := range binaries {
build("grafana-cli", "./pkg/cmd/grafana-cli", []string{}) build(binary, "./pkg/cmd/"+binary, []string{})
}
case "test": case "test":
test("./pkg/...") test("./pkg/...")
...@@ -138,6 +139,7 @@ func readVersionFromPackageJson() { ...@@ -138,6 +139,7 @@ func readVersionFromPackageJson() {
type linuxPackageOptions struct { type linuxPackageOptions struct {
packageType string packageType string
homeDir string homeDir string
binPath string
serverBinPath string serverBinPath string
cliBinPath string cliBinPath string
configDir string configDir string
...@@ -160,8 +162,7 @@ func createDebPackages() { ...@@ -160,8 +162,7 @@ func createDebPackages() {
createPackage(linuxPackageOptions{ createPackage(linuxPackageOptions{
packageType: "deb", packageType: "deb",
homeDir: "/usr/share/grafana", homeDir: "/usr/share/grafana",
serverBinPath: "/usr/sbin/grafana-server", binPath: "/usr/sbin",
cliBinPath: "/usr/sbin/grafana-cli",
configDir: "/etc/grafana", configDir: "/etc/grafana",
configFilePath: "/etc/grafana/grafana.ini", configFilePath: "/etc/grafana/grafana.ini",
ldapFilePath: "/etc/grafana/ldap.toml", ldapFilePath: "/etc/grafana/ldap.toml",
...@@ -183,8 +184,7 @@ func createRpmPackages() { ...@@ -183,8 +184,7 @@ func createRpmPackages() {
createPackage(linuxPackageOptions{ createPackage(linuxPackageOptions{
packageType: "rpm", packageType: "rpm",
homeDir: "/usr/share/grafana", homeDir: "/usr/share/grafana",
serverBinPath: "/usr/sbin/grafana-server", binPath: "/usr/sbin",
cliBinPath: "/usr/sbin/grafana-cli",
configDir: "/etc/grafana", configDir: "/etc/grafana",
configFilePath: "/etc/grafana/grafana.ini", configFilePath: "/etc/grafana/grafana.ini",
ldapFilePath: "/etc/grafana/ldap.toml", ldapFilePath: "/etc/grafana/ldap.toml",
...@@ -219,9 +219,9 @@ func createPackage(options linuxPackageOptions) { ...@@ -219,9 +219,9 @@ func createPackage(options linuxPackageOptions) {
runPrint("mkdir", "-p", filepath.Join(packageRoot, "/usr/sbin")) runPrint("mkdir", "-p", filepath.Join(packageRoot, "/usr/sbin"))
// copy binary // copy binary
runPrint("cp", "-p", filepath.Join(workingDir, "tmp/bin/grafana-server"), filepath.Join(packageRoot, options.serverBinPath)) for _, binary := range binaries {
// copy binary runPrint("cp", "-p", filepath.Join(workingDir, "tmp/bin/"+binary), filepath.Join(packageRoot, "/usr/sbin/"+binary))
runPrint("cp", "-p", filepath.Join(workingDir, "tmp/bin/grafana-cli"), filepath.Join(packageRoot, options.cliBinPath)) }
// copy init.d script // copy init.d script
runPrint("cp", "-p", options.initdScriptSrc, filepath.Join(packageRoot, options.initdScriptFilePath)) runPrint("cp", "-p", options.initdScriptSrc, filepath.Join(packageRoot, options.initdScriptFilePath))
// copy environment var file // copy environment var file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment