summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a6910dc2611d368154a04d1b3893e9f26d8a2c0c (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
# Maintainer: Phillip Smith <pkgbuild@phs.id.au>
# http://github.com/fukawi2/aur-packages
# Contributor: Valere Monseur <valere_monseur@hotmail.com>

### I AM ONLY THE PACKAGER, NOT THE DEVELOPER
### Please ask support questions about this software in one of:
###   1) The AUR comments; OR
###   2) Upstream forums/maillist etc; OR
###   3) The ArchLinux forums
### I do not always know enough about the software itself, or don't have the
### time to promptly respond to direct emails.
### If you have found a problem with the package/PKGBUILD (as opposed to
### the software) then please do email me or post an AUR comment.

pkgname=iptrafvol
_pkgname=iptrafficvolume
pkgver=0.3.4
pkgrel=6
pkgdesc="IP traffic volume logger using iptables"
arch=('i686' 'x86_64')
url="http://iptrafficvolume.sourceforge.net/"
license=('GPL')
depends=('iptables' 'perl')
source=("http://downloads.sourceforge.net/project/${_pkgname}/${_pkgname}/${pkgver}/${pkgname}-${pkgver}.tgz"
        'fix-pod.patch'
        'iptrafvol.timer'
        'iptrafvol.service')
md5sums=('21d96650dd6452792ad47a5636954053'
         '4201e99e219f92ec7b5147c65c09fda9'
         '0d612976c4cc7e6a133926721bbf6232'
         'dc2737ba522b528c6f35872798497afe')

prepare() {
  cd "$srcdir"/${pkgname}-${pkgver}
  patch < "$srcdir"/fix-pod.patch
}

package() {
  cd "$srcdir"/${pkgname}-${pkgver}

  # generate man page
  pod2man iptrafvol.pl > iptrafvol.1
  gzip --force iptrafvol.1

  # install directories
  install -d "$pkgdir"/var/log/iptrafvol

  # install files
  install -D -m755 iptrafvol.pl "$pkgdir"/usr/bin/iptrafvol.pl
  install -D -m644 iptrafvol.cgi "$pkgdir"/usr/share/${pkgname}/iptrafvol.cgi
  install -D -m644 orange.css "$pkgdir"/usr/share/${pkgname}/orange.css
  install -D -m644 Examples/iptrafvol_cron.d "$pkgdir"/usr/share/${pkgname}/iptrafvol_cron.d
  install -D -m644 Examples/iptrafvol_init.d "$pkgdir"/usr/share/${pkgname}/iptrafvol_init.d
  install -D -m644 iptrafvol.1.gz "$pkgdir"/usr/share/man/man1/iptrafvol.1.gz
  install -D -m644 COPYING "$pkgdir"/usr/share/licenses/${pkgname}/COPYING

  # install systemd units (thanks to @Amplificator)
  install -D -m755 "$srcdir"/iptrafvol.timer   "$pkgdir"/usr/lib/systemd/system/iptrafvol.timer
  install -D -m755 "$srcdir"/iptrafvol.service "$pkgdir"/usr/lib/systemd/system/iptrafvol.service

  # adapt config to suits arch
  sed \
    -e 's|/sbin/iptables|/usr/bin/iptables|' \
    -i "$pkgdir"/usr/bin/iptrafvol.pl

  sed \
    -e 's|/usr/local/sbin/iptrafvol.pl|/usr/bin/iptrafvol.pl|' \
    -i "$pkgdir"/usr/share/${pkgname}/iptrafvol.cgi \
    -i "$pkgdir"/usr/share/${pkgname}/iptrafvol_cron.d \
    -i "$pkgdir"/usr/share/${pkgname}/iptrafvol_init.d
}