<p>Hi
So I'm playing with Grafana </p>
<p><a href="http://docs.grafana.org/project/building_from_source/" rel="nofollow">http://docs.grafana.org/project/building_from_source/</a></p>
<p>and I've been folowing the build from source guide above as I couldn't find binaries for i386. This works well except that the binaries end up where i built them (under my home dir).
My question is, what is the Go version of 'make install' ?
Is it possible to automatically install the bin in a system location and ideally get the init scripts and config scripts be created/put in the correct spots (e.g. /etc) or does it have to be done manually ?
Thanks</p>
<p>[Update- Solved]
On the page above it details how to create a package via </p>
<pre><code>go run build.go build package
</code></pre>
<p>and that installs things into the correct locations
Thanks for the help and suggestions</p>
<hr/>**评论:**<br/><br/>q1t: <pre><p>there is a 'go install' which will install a binary under $GOPATH/bin,
just place a $GOPATH/bin in your system's $PATH</p></pre>lakid74: <pre><p>no worries. It's not so much the 'put it the bin in a new location' i'm after it's more the systemd and etc files i'm after so I can daemonise it
Thanks</p></pre>icholy: <pre><p>I like supervisord</p></pre>bboozzoo: <pre><p>It's out of the scope of go tools. Use whatever method you would use for other software, eg. Makefile with an <code>install</code> target with suffice.</p>
<p>For instance, docker has a Makefile but without an <code>install</code> target. In this case, in the spec for Fedora's packages, the binaries are just copied over to proper locations.</p></pre>lakid74: <pre><p>ah ok, got it thanks.</p></pre>CrankBot: <pre><p>Grafana probably has package build & install scripts somewhere in the source tree... Seems there is not a "go" way to do it but you should be able to see what they did to take the executable and package it for RHEL & Debian.</p></pre>lakid74: <pre><p>ok will have a look around, thanks for the input.</p></pre>BasicDesignAdvice: <pre><p>You could probably turn it into a package using fpm.</p></pre>lakid74: <pre><p>yes and this did what I was after. On the link above it details how to create the package using</p>
<pre><code>go run build.go build package
</code></pre>
<p>and that did exactly what i wanted...thanks !</p></pre>[deleted]: <pre><p>Checking out the source, it looks like <code>build.go</code> has a number of options: <a href="https://github.com/grafana/grafana/blob/master/build.go" rel="nofollow">https://github.com/grafana/grafana/blob/master/build.go</a></p>
<p>Try running with the <code>package</code> option (<code>go run build.go package</code>) and it looks like it'll build .deb and .rpms of it which you can then install whichever is appropriate for your distro.</p></pre>lakid74: <pre><p>Yep that's what I did and it all worked. Thanks !</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传