Repository navigation
Expand file tree
/
Copy pathmake-source-tarball
More file actions
executable file
·76 lines (64 loc) · 2.21 KB
/
Copy pathmake-source-tarball
File metadata and controls
executable file
·76 lines (64 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# use $TMPDIR as temporary space for improved performance
for N in 1 2; do
eval "`sed -n "s/^%define plugin\(${N}_[^ ]*\) /plugin\1=/p" rpm/htvault-config.spec`"
eval plugin${N}_prefix=v
eval plugin_version=\${plugin${N}_version}
if [[ "$plugin_version" == commit/* ]]; then
eval plugin${N}_prefix=""
eval plugin${N}_version=\${plugin_version#commit/}
fi
done
V=gox_version
eval "`sed -n "s/^%define $V /$V=/p" rpm/htvault-config.spec`"
BASE=htvault-config-src
set -ex
cd "`dirname $0`"
HERE=$PWD
cd ${TMPDIR:-/tmp}
for OLDBASE in $BASE-*; do
if [ -d $OLDBASE/gopath ]; then
# this is in case it wasn't fully created and chmodded
GOPATH=$PWD/$OLDBASE/gopath go clean -modcache
fi
done
rm -rf $BASE-*
BASE="$BASE-`sed -n 's/^%define tarball_version //p' $HERE/rpm/htvault-config.spec`"
mkdir $BASE
cd $BASE
# install required go version
mkdir gopath
export GOPATH=$PWD/gopath
#OPENBAOVERSION="`sed -n 's/^%define openbao_version //p' $HERE/rpm/htvault-config.spec`"
#GOVERSION="`curl https://raw.githubusercontent.com/openbao/openbao/refs/tags/v$OPENBAOVERSION/.go-version`"
#curl -sSL https://golang.org/dl/go$GOVERSION.src.tar.gz | tar -xzf -
#pushd go/src
#GOSRC=$PWD
#./make.bash
#popd
#PATH=$PWD/go/bin:$GOPATH/bin:$PATH
#go version
curl -s https://codeload.github.com/42wim/${plugin1_name}/tar.gz/${plugin1_prefix}${plugin1_version} | tar xzf -
cd ${plugin1_name}-${plugin1_version}
curl -Ls https://github.com/42wim/${plugin1_name}/pull/${plugin1_patch1}.patch | patch -p1
go mod vendor
cd ..
curl -s https://codeload.github.com/openbao/${plugin2_name}/tar.gz/${plugin2_prefix}${plugin2_version} | tar xzf -
cd ${plugin2_name}-${plugin2_version}
go mod vendor
make generate
cd ..
cd ..
find $GOPATH/pkg/mod -type d ! -perm -200 -print0|xargs -0 -r chmod u+w
rm -rf $GOPATH/pkg
# do the install for its side effects of caching the source files
# NOTE: gox might be no longer needed after 2.6.0:
# https://github.com/openbao/openbao/pull/2801
go install github.com/mitchellh/gox@v$gox_version
rm -f $GOPATH/bin/gox
find $GOPATH/pkg/mod -type d ! -perm -200 -print0|xargs -0 -r chmod u+w
#pushd $GOSRC
#./clean.bash
#popd
tar --exclude .git -czf $HERE/$BASE.tar.gz $BASE
rm -rf $BASE