blob: 9507548df3fa9b6b98e5b940271dcb6fc9fb8597 (
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
112
113
114
115
116
|
# Maintainer:
# Contributor: Riccardo Berto <riccardo at rcrdbrt dot-symbol com>
# Contributor: Moses Narrow <moe-narrow@use.startmail.com>
# Contributor: Dimitris Kiziridis <ragouel at outlook dot com>
# Contributor: Konrad Tegtmeier <konrad.tegtmeier+aur@gmail.com>
# Contributor: Marcel O'Neil <marcel@marceloneil.com>
## links
# https://www.cockroachlabs.com/docs/stable/install-cockroachdb-linux.html
# https://github.com/cockroachdb/cockroach
# https://www.cockroachlabs.com/docs/releases/
_pkgname=cockroachdb
pkgname="$_pkgname-bin"
pkgver=24.2.5
pkgrel=1
pkgdesc="Cloud-native, distributed SQL database"
url='https://www.cockroachlabs.com'
license=('LicenseRef-CockroachDB')
arch=('x86_64')
depends=('glibc')
makedepends=('chrpath')
conflicts=("$_pkgname=${pkgver}")
provides=("$_pkgname")
options=('!debug')
backup=("etc/default/cockroach")
_pkgsrc="cockroach-v$pkgver.linux-amd64"
_pkgsrc_source="cockroach-$pkgver"
source=(
"$_pkgname-$pkgver.tar.gz"::"https://binaries.cockroachdb.com/$_pkgsrc.tgz"
"LICENSE-$pkgver"::"https://github.com/cockroachdb/cockroach/raw/v$pkgver/LICENSE"
)
sha256sums=(
'720a334954be6f98917f88802a3b485f40c2b454da0dd91d383cfdab6908afb7'
'cb4f34a516b09ec1815bd8376a34de7ea5e6da06c70bed756110943ad1b340e4'
)
build() {
# generate shell completion
"$_pkgsrc/cockroach" gen autocomplete bash --out "cockroach.bash"
"$_pkgsrc/cockroach" gen autocomplete zsh --out "cockroach.zsh"
# generate man pages
"$_pkgsrc/cockroach" gen man --path "man"
}
package() {
local _install_path='usr/lib'
# binary
install -Dm755 "$_pkgsrc/cockroach" "$pkgdir/$_install_path/$_pkgname/cockroach"
# GEOS libraries
install -Dm644 "$_pkgsrc/lib/libgeos.so" "$pkgdir/$_install_path/$_pkgname/lib/libgeos.so"
install -Dm644 "$_pkgsrc/lib/libgeos_c.so" "$pkgdir/$_install_path/$_pkgname/lib/libgeos_c.so"
chrpath -r /usr/lib/cockroachdb "$pkgdir/$_install_path/$_pkgname/lib/libgeos_c.so"
# script
install -Dm755 /dev/stdin "$pkgdir/usr/bin/cockroach" << END
#!/usr/bin/env sh
exec /$_install_path/$_pkgname/cockroach "\$@"
END
# user/group & owned directories
install -Dm644 /dev/stdin "$pkgdir/usr/lib/sysusers.d/cockroach.conf" << END
u cockroach - "CockroachDB" /var/lib/cockroach
END
install -Dm644 /dev/stdin "$pkgdir/usr/lib/tmpfiles.d/cockroach.conf" << END
d /etc/cockroach 0755 root cockroach - -
d /var/lib/cockroach 0750 cockroach cockroach - -
END
# services & runtime
install -Dm644 /dev/stdin "$pkgdir/usr/lib/systemd/system/cockroach.service" << END
[Unit]
Description=CockroachDB database server
Requires=network-online.target
After=network-online.target
[Service]
User=cockroach
Group=cockroach
EnvironmentFile=-/etc/default/cockroach
ExecStart=/usr/bin/cockroach start --certs-dir /etc/cockroach --store=${COCKROACH_STORE} $COCKROACH_FLAGS
LimitNOFILE=35000
ProtectHome=true
ProtectSystem=full
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
END
install -Dm644 /dev/stdin "$pkgdir/etc/default/cockroach" << END
COCKROACH_FLAGS="--insecure"
COCKROACH_STORE="path=/var/lib/cockroach"
END
# man pages
install -Dm644 "man"/*.1 -t "$pkgdir/usr/share/man/man1/"
# shell completion
install -Dm644 cockroach.bash "$pkgdir/usr/share/bash-completion/completions/cockroach"
install -Dm644 cockroach.zsh "$pkgdir/usr/share/zsh/site-functions/_cockroach"
# licenses
install -Dm644 "LICENSE-$pkgver" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
|