blob: 54e48cb3af3f84aa304d0d6465bc1b6d9e01c129 (
plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# Maintainer: Josias <aur at macherstube dot ch>
_pkgname=kubo
_pkgplgname=$_pkgname-s3
pkgname=$_pkgplgname-git
pkgver=0.23.0.r0.g3a1a041
pkgrel=3
pkgdesc="IPFS Kubo with S3 Datastore Implementation"
arch=('x86_64')
url="https://github.com/chixodo-xyz/kubo-s3"
license=('GPL3')
groups=()
depends=(glibc)
makedepends=(go git)
provides=("$_pkgplgname" "ipfs")
conflicts=("$_pkgplgname" 'kubo' 'ipfs')
replaces=()
backup=()
options=()
install='prod.install'
source=('git+https://github.com/ipfs/kubo#tag=v0.23.0'
'git+https://github.com/ipfs/go-ds-s3#tag=v0.9.0'
'versions.txt'
'ipfs.service')
noextract=()
b2sums=('SKIP'
'SKIP'
'ba0b7a7ca53a069a58ec6f9dbab98f10120a5ffd2f8ce83fabf21ae8749e29151879d3245a8cf7e6380119c19a57114f7c4696dcaf93c3b712ad3c2eb1c78058'
'3ef6073e708a35ab57107e8c4fb8b07172ffc314719b84565f82ca54c14fadd0ddfcae2b30c8b28c4d60dd9a13ccab463384c5c6140340396afdd0d3505dfc23')
prepare() {
cd "$srcdir/$_pkgname"
KuboVersion=$(git describe --tags --abbrev=0)
printf "\033[34;1mPrepare Kubo %s (%s)\n\033[0m" ${KuboVersion} $(git describe --long --tags --abbrev=7 --match="v*" HEAD |
sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
git config advice.detachedHead false
git checkout ${KuboVersion} -f
if [ $? -ne 0 ]; then
printf "\033[31;1mTag not found.\n\033[0m"
exit -1
fi
GoVersion=$(grep "${KuboVersion} " ../versions.txt | awk '{ print $2 }')
if [ -z "$GoVersion" ]; then
ln -sf $(which go) $srcdir/go
else
printf "\033[34;1mInstalling go version: %s\n\033[0m" ${GoVersion}
GOPATH=$(go env GOPATH)
GOROOT=$(go env GOROOT)
go install golang.org/dl/${GoVersion}@latest
ln -sf $GOPATH/bin/$GoVersion $srcdir/go
$srcdir/go download
GOVERSIONROOT=$($srcdir/go env GOROOT)
GOVERSIONPATH=$($srcdir/go env GOPATH)
cp $GOROOT/go.env $GOVERSIONROOT/go.env
export GOROOT=$GOVERSIONROOT
export GOPATH=$GOVERSIONPATH
fi
export GO111MODULE=on
printf "\033[34;1mFetching go-ds-s3 plugin\n\033[0m"
$srcdir/go get github.com/ipfs/go-ds-s3/plugin@v0.9.0
echo -en "\ns3ds github.com/ipfs/go-ds-s3/plugin 0" >> plugin/loader/preload_list
sed -i "s\GOCC ?= go\GOCC ?= ${srcdir}/go\g" Rules.mk
sed -Ei "s/const CurrentVersionNumber = \"(.*)\"/const CurrentVersionNumber = \"\1-s3\"/g" version.go
}
pkgver() {
cd "$srcdir/$_pkgname"
git describe --long --tags --abbrev=7 --match="v*" HEAD |
sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
cd "$srcdir/$_pkgname"
printf "\033[34;1mBuild Kubo with S3 Plugin\n\033[0m"
make build
$srcdir/go mod tidy
make build
if [ $? -ne 0 ]; then
printf "\033[31;1mBuild failed.\n\033[0m"
exit -1
fi
}
check() {
cd "$srcdir/$_pkgname"
printf "\033[0;35mIPFS Version: $(cmd/ipfs/ipfs version)\n\033[0m"
if [ $? -ne 0 ]; then
printf "\033[31;1mCheck failed.\n\033[0m"
exit -1
fi
}
package() {
cd "$srcdir"
mkdir -p $pkgdir/usr/bin
cp "${srcdir}/$_pkgname/cmd/ipfs/ipfs" "${pkgdir}/usr/bin/ipfs"
mkdir -p $pkgdir/usr/lib/systemd/system
cp "${srcdir}/ipfs.service" "${pkgdir}/usr/lib/systemd/system/ipfs.service"
printf "\033[36;1mBuild to: $pkgdir/usr/bin/ipfs\n\033[0m"
}
|