aboutsummaryrefslogtreecommitdiffstats
path: root/community/syncthing/APKBUILD
blob: 6a882759ef4339b49639460fee3dd52cddcf3e51 (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
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=syncthing
pkgver=1.17.0
pkgrel=0
pkgdesc="Open Source Continuous File Synchronization"
options="chmod-clean"
url="https://syncthing.net/"
arch="all"
license="MPL-2.0"
pkgusers="$pkgname"
pkggroups="$pkgname"
makedepends="go"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-utils $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/syncthing/syncthing/archive/v$pkgver.tar.gz
	only-test-with-race-when-provided.patch
	$pkgname.initd
	"

# secfixes:
#   1.15.1-r0:
#     - CVE-2021-21404

build() {
	# Build syncthing + server utils
	local cmd
	for cmd in syncthing stdiscosrv strelaypoolsrv strelaysrv; do
		echo "Compiling $cmd"
		go run build.go -no-upgrade -version=v$pkgver install $cmd
	done
}

check() {
	go run build.go -no-upgrade test
}

package() {
	install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname
	install -D -m755 "$builddir"/bin/$pkgname "$pkgdir"/usr/bin/$pkgname
	install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname

	# Desktop files so people in Desktop Environments can put them on Autostart
	install -Dm0644 etc/linux-desktop/*.desktop -t "$pkgdir"/usr/share/applications

	# man pages
	cd "$builddir/man"
	local file
	for file in *.1; do
		install -Dm644 "$file" "$pkgdir"/usr/share/man/man1/"$file"
	done
	for file in *.5; do
		install -Dm644 "$file" "$pkgdir"/usr/share/man/man5/"$file"
	done
	for file in *.7; do
		install -Dm644 "$file" "$pkgdir"/usr/share/man/man7/"$file"
	done
}

utils() {
	cd "$builddir/bin"
	pkgdesc="Syncthing server utilities"
	for i in *; do
		if ! [ "$i" = "$pkgname" ]; then
			install -Dm 755 "$builddir"/bin/"$i" "$subpkgdir"/usr/bin/"$i"
		fi
	done
}

sha512sums="
6ccc43bf21ce20543031e070b14e5383a1bee6a0c6df5a0e1a914d2fae51f04d7776f715e4874c2b854798cc89236028955be6a462574bdafb6bc9dd56bce854  syncthing-1.17.0.tar.gz
81bcb6b2e0956624b596201d1de24a3b6fcb10d08761f2c426081350b611295a7f4d47775d175f2ee5dbbb289b98bc022389fc9992f0d31bcdbfde855ceafaf8  only-test-with-race-when-provided.patch
7fe49210180827c28f3ee9a1a95da3884dbef34de9bdc643f4455c9a056adba81f16c1c6ac059e83bee360aea091ace98b8a6f4c4b26a32c450f61f15206d3f5  syncthing.initd
"