summaryrefslogtreecommitdiff
path: root/user/apaste/APKBUILD
blob: 13db635b033aa853ab0681da1f6a0034a464b2dc (plain) (blame)
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
# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=apaste
pkgver=0.0.2.1
pkgrel=0
pkgdesc="A command-line pastebin"
url="https://skarnet.org/software/apaste/"
arch="all"
options="!check"  # No test suite.
license="ISC"
_skalibs_version=2.14.3
_execline_version=2.9.6
_s6_version=2.13.1
_s6net_version=2.7.0
depends="s6-networking"
makedepends="skalibs-dev>=$_skalibs_version s6-networking-dev>=$_s6net_version"
subpackages="apaste-doc apasted:server apasted-openrc:apasted_openrc"
source="
	https://skarnet.org/software/apaste/apaste-$pkgver.tar.gz
	apasted.run
	apastesd.run
	apasted-log.run
	apasted.confd
	apasted.initd
	"
pkggroups="apasted"
pkgusers="apastedlog apasted"

build() {
	./configure \
		--enable-shared \
		--disable-allstatic \
		--prefix=/usr
	make
}

_makeservicedir() {
	name="apaste${1}d-${2}"
	fn="$subpkgdir/var/lib/apasted/services/$name"
	mkdir -p "$fn/log"
	echo 3 > "$fn/log/notification-fd"
	sed -e "s/@S@/${1}/g; s/@V@/${2}/g;" "$srcdir/apasted-log.run" > "$fn/log/run"
	chmod 0755 "$fn/log/run"
	echo 3 > "$fn/notification-fd"
	sed -e "s/@V@/${2}/g;" "$srcdir/apaste${1}d.run" > "$fn/run"
	chmod 0755 "$fn/run"
	fn="$subpkgdir/var/log/$name"
	mkdir -p "$fn"
	chown apastedlog:apasted "$fn"
	chmod 02700 "$fn"
}

package() {
	make DESTDIR="$pkgdir" install
	install -D -m 0644 "$srcdir/apasted.confd" "$pkgdir/etc/conf.d/apasted"
	install -D -m 0755 "$srcdir/apasted.initd" "$pkgdir/etc/init.d/apasted"
	mkdir -p -m 0755 "$pkgdir/usr/share/doc"
	cp -a "$builddir/doc" "$pkgdir/usr/share/doc/$pkgname"
}

server() {
	depends="execline>=$_execline_version s6>=$_s6_version s6-networking>=$_s6net_version apasted-openrc"
	pkgdesc="A server for the apaste command-line pastebin"
	install="apasted.pre-install"
	mkdir -p "$subpkgdir/usr/bin" "$subpkgdir/var/lib/apasted/services"
	mv "$pkgdir/usr/bin/apasted" "$subpkgdir/usr/bin/"
	for i in '' s ; do for j in 4 6 ; do
		_makeservicedir "$i" "$j"
	done ; done
}

apasted_openrc() {
	depends="apasted"
	install -D -m 0644 "$srcdir/apasted.confd" "$subpkgdir/etc/conf.d/apasted"
	install -D -m 0755 "$srcdir/apasted.initd" "$subpkgdir/etc/init.d/apasted"
}

sha512sums="262c149941d414130e7bfcbf7ecbc858427f5acd20880a68216935f79ad2632b9d82ff87cc09874d3d7215db9ebc4c55de7355ac9e29740751f44e9b2b4f8229  apaste-0.0.2.1.tar.gz
970a79b6da5a7c58539cd9d47cba36855eb4f37e1e0bbd841ade15022b5fb291a077f7ad118ff662a45f3b2b59162264a180c338f23f964ea3e48364c68ac606  apasted.run
817b276ae51e9bd769e39a8313a84449d181c65749640119ba1e4af3c21d2572152c7bdd5eec70cbcfaa3255fd6cba966dfc1dc7a818a60d329283c39ae058a8  apastesd.run
9341c1c69c1d45b35052b0042665fffb9cff6583fad558ed37a19af574b53a5e298727c43a6c718fd40936e8f16d1a10e9c229392595ba1e06ddb21d1d8b055b  apasted-log.run
3b91225252d95d676097d337ca77ef2bdffb52baa657197efe079b82c663baeaed0882993eeed7f7ce260f051e439159c61368f8a1d4b84d1daa74fe358c39d7  apasted.confd
f9e6dd5aa6d5efe678f370431e7b58a52f903eed9b698f60b1853d601a4d9c0a53ccb996034d401dfd7ddbe573fc2651cf5c87164de599c42f754ad015b8e302  apasted.initd"