summaryrefslogtreecommitdiff
path: root/user/apaste/APKBUILD
blob: 42c4a0c171fac086a110124d25b18bc1925a1aa1 (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
# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=apaste
pkgver=0.0.2.0
pkgrel=2
pkgdesc="A command-line pastebin"
url="https://skarnet.org/software/apaste/"
arch="all"
options="!check"  # No test suite.
license="ISC"
depends="s6-networking"
makedepends="skalibs-dev>=2.14.1.1 s6-networking-dev>=2.7.0.2"
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
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

_makeservicedir() {
	name="apaste${1}d-${2}"
	fn="$subpkgdir/var/lib/apasted/services/$name"
	mkdir -p -m 0755 "$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"
}

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 s6 s6-networking>=2.7.0.2 apasted-openrc"
	pkgdesc="A server for the apaste command-line pastebin"
	install="apasted.pre-install apasted.post-install"
	mkdir -p -m 0755 "$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() {
	default_openrc
        pkgdesc="A server for the apaste command-line pastebin (OpenRC init scripts)"
        install_if="openrc apasted=$pkgver-r$pkgrel"
}

sha512sums="b1550d738801ddee528d0ce62333aa9a8fc9824183a61be295e767fbcdb1ae4d15a5e34295754cc5e8c51c8b410a56972bac28c5812099652fb8bb5140fb4c15  apaste-0.0.2.0.tar.gz
27f6b3ac98f52a6ed11d225ea19e34160b1fef2dd980a32a43ff03499e121b6418612be4c94d1139388bee47b14a5ea24edc383fcfcfe55abe7daf12be2d514c  apasted.run
8cd74ba6c6579912083f9605056b46ca2887faaf23a0d1981043a5ac4d6e724def51a7c087fb719f2b0189e6b0a0d9469a1e955fcbf04c8ea9f2d818649c122e  apastesd.run
9341c1c69c1d45b35052b0042665fffb9cff6583fad558ed37a19af574b53a5e298727c43a6c718fd40936e8f16d1a10e9c229392595ba1e06ddb21d1d8b055b  apasted-log.run
3b91225252d95d676097d337ca77ef2bdffb52baa657197efe079b82c663baeaed0882993eeed7f7ce260f051e439159c61368f8a1d4b84d1daa74fe358c39d7  apasted.confd
da909cfc4aaa6571dda2fa0e4713e61c1b7f18ca35907ce4d0e3aa639596c69d801d6369b43ce67b20aa8d8a4050f46d98823b6158f80170866263b7b7a79e5b  apasted.initd"