summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e009d123d23c0aea519ab2e3975f4a24bba6caf7 (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
# Maintainer: Andrew Hills <ahills@ednos.net>
pkgname=hosts-gen
pkgver=0.9.20191123.2
# No actual releases provided; use a specific commit
_pkgcommit=562b4af551efc7249cb68f6d4b8909daf2ce7ce6
pkgrel=2
epoch=
pkgdesc="A little framework to generate /etc/hosts from /etc/hosts.d"
arch=('any')
url="http://r-36.net/scm/$pkgname/"
license=('GPL3')
groups=()
depends=('coreutils')
makedepends=('git')
backup=()
options=()
install="$pkgname.install"
source=("$pkgname::git://r-36.net/$pkgname#commit=$_pkgcommit"
				"$pkgname.path"
				"$pkgname.service")
md5sums=('SKIP'
         '470be01a8490fc054fb0a04d3a74eed1'
         '12ed5fdea9f047bb03e61e8f846c641a')
validpgpkeys=()

pkgver() {
	cd "$pkgname"
	set +x
	local version=$(sed -n -e 's/^VERSION = //p' config.mk)
	# group commits by date, counting the ones on the date chosen for the version
	local commitdate=$(git show -s --date=short --format=%cd)
	local datecommits=$(git rev-list --since="$commitdate 00:00 UTC" HEAD | wc -l)
	git show -s --date=format:%Y%m%d --format=format:$version.%cd.$datecommits
}

package() {
	cd "$pkgname"
	make DESTDIR="$pkgdir/" install
	# Generate this from /etc/hosts on install
	rm "$pkgdir/etc/hosts.d/01-hosts.local"
	# Correct executable location
	mkdir -p "$pkgdir/usr"
	mv "$pkgdir/bin" "$pkgdir/usr/bin"
	# Install documentation
	mkdir -p "$pkgdir/usr/share/doc/$pkgname"
	install -m0644 "$srcdir/$pkgname/README" "$pkgdir/usr/share/doc/$pkgname/README"
	install -m0644 "$srcdir/$pkgname/LICENSE" "$pkgdir/usr/share/doc/$pkgname/LICENSE"
	# Install systemd units
	mkdir -p "$pkgdir/usr/lib/systemd/system"
	install -m0644 "$srcdir/$pkgname.path" "$pkgdir/usr/lib/systemd/system/$pkgname.path"
	install -m0644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
}