forked from ungleich-public/cdist
add __go_get, __golang_from_vendor
This commit is contained in:
parent
df7ef403bc
commit
21a29ab5aa
9 changed files with 58 additions and 0 deletions
1
cdist/conf/explorer/kernel_name
Normal file
1
cdist/conf/explorer/kernel_name
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uname -s
|
3
cdist/conf/type/__go_get/explorer/go-executable
Normal file
3
cdist/conf/type/__go_get/explorer/go-executable
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[ -f /etc/environment ] && . /etc/environment
|
||||||
|
[ -f /etc/profile ] && . /etc/profile
|
||||||
|
go version 2>/dev/null || true
|
8
cdist/conf/type/__go_get/gencode-remote
Normal file
8
cdist/conf/type/__go_get/gencode-remote
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package=$__object_id
|
||||||
|
|
||||||
|
cat<<EOF
|
||||||
|
[ -f /etc/environment ] && . /etc/environment
|
||||||
|
[ -f /etc/profile ] && . /etc/profile
|
||||||
|
export GOPATH=\${GOPATH:-/opt/gocode}
|
||||||
|
go get $package
|
||||||
|
EOF
|
17
cdist/conf/type/__go_get/manifest
Normal file
17
cdist/conf/type/__go_get/manifest
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
go_executable=$(cat "$__object/explorer/go-executable")
|
||||||
|
[ -z "$go_executable" ] && echo "__go_get: Cannot find go executable; make sure it is installed and in PATH" >&2 && exit 1
|
||||||
|
|
||||||
|
os=$(cat "$__global/explorer/os")
|
||||||
|
case $os in
|
||||||
|
debian|devuan|ubuntu)
|
||||||
|
__package build-essential
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "__go_get: Don't know how to install g++ on $os" >&2
|
||||||
|
echo "__go_get: Send a pull request or contact <kamila@ksp.sk> to add support for $os." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
26
cdist/conf/type/__golang_from_vendor/gencode-remote
Normal file
26
cdist/conf/type/__golang_from_vendor/gencode-remote
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
version=$(cat "$__object/parameter/version")
|
||||||
|
|
||||||
|
kernel_name=$(cat "$__global/explorer/kernel_name" | tr '[:upper:]' '[:lower:]')
|
||||||
|
machine=$(cat "$__global/explorer/machine")
|
||||||
|
case $machine in
|
||||||
|
x86_64|amd64)
|
||||||
|
arch=amd64
|
||||||
|
;;
|
||||||
|
x86)
|
||||||
|
arch=386
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
arch=$machine # at least try...
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
PACKAGE="go${version}.${kernel_name}-${arch}"
|
||||||
|
URL="https://storage.googleapis.com/golang/${PACKAGE}.tar.gz"
|
||||||
|
cat <<EOF
|
||||||
|
[ "x\$(cat /usr/local/go/VERSION 2>/dev/null)" = "xgo$version" ] && exit 0 # already there
|
||||||
|
wget --no-verbose "$URL" -O "/tmp/${PACKAGE}.tar.gz"
|
||||||
|
rm -rf /usr/local/go
|
||||||
|
tar -C /usr/local -xzf /tmp/${PACKAGE}.tar.gz
|
||||||
|
EOF
|
1
cdist/conf/type/__golang_from_vendor/manifest
Normal file
1
cdist/conf/type/__golang_from_vendor/manifest
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__line go_in_path --line 'export PATH=/usr/local/go/bin:$PATH' --file /etc/profile
|
|
@ -0,0 +1 @@
|
||||||
|
1.8.1
|
1
cdist/conf/type/__golang_from_vendor/parameter/optional
Normal file
1
cdist/conf/type/__golang_from_vendor/parameter/optional
Normal file
|
@ -0,0 +1 @@
|
||||||
|
version
|
0
cdist/conf/type/__golang_from_vendor/singleton
Normal file
0
cdist/conf/type/__golang_from_vendor/singleton
Normal file
Loading…
Reference in a new issue