summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d19179e808ed5ee6f3f8eda7a007232fcd6fb3c3 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Maintainer: Dimitris Kiziridis <ragouel at outlook dot com>

pkgname=tranalyzer
pkgver=0.8.8
pkgrel=2
pkgdesc='Lightweight flow generator and packet analyzer'
arch=('i686' 'x86_64')
url='https://tranalyzer.com'
license=('GPL3')
depends=('libpcap'
         'mongo-c-driver'
         'postgresql-libs'
         'mariadb-libs'
         'sqlite'
         'libbsd'
         'pcre'
         'gawk')
optdepends=('graphviz: Required by some plugins'
            'gnuplot: Required by gpq3x, plot_monitoring'
            'p0f: Required by osStat'
            'rrdtool: Required by rrdmonitor, rrdplot'
            'inotify-tools: Required by t2dmon')
makedepends=('mongo-c-driver'
             'libtool'
             'cmake')
source=("${pkgname}-${pkgver}.tar.gz::https://tranalyzer.com/download/tranalyzer/tranalyzer2-${pkgver}lmw4.tar.gz")
sha256sums=('55beaa92d6269a184aea9e2a8ecbda029cbba932ee1a3ab12807d1d76026cce9')

prepare() {
  cd "${pkgname}2-${pkgver}"
  sed -i "29s|\.tranalyzer/plugins/|/usr/lib/tranalyzer/plugins|" tranalyzer2/src/tranalyzer.h
  sed -i "43s|.*|T2FMDIR=/usr/share/tranalyzer/scripts/t2fm|" scripts/t2fm/t2fm
  sed -i "7s|\$(dirname \"$\0\")|/usr/share/tranalyzer/scripts/tawk|" scripts/tawk/tawk 

  for script in b64ex fpsGplt gpq3x osStat plot_monitoring protStat rrdmonitor rrdplot statGplt t2alive t2caplist t2dmon t2flowstat t2plot t2stat t2timeline t2viz topNStat; do
    sed -i "s|\$(dirname \"$\0\")|/usr/share/tranalyzer/scripts|" scripts/${script}
  done
}

build() {
  cd "${pkgname}2-${pkgver}"
  echo y | ./autogen.sh -a -p "${srcdir}/${pkgname}2-${pkgver}/build/plugins"
  gzip --force tranalyzer2/man/tranalyzer.1
  gzip --force scripts/t2conf/man/t2conf.1
  gzip --force scripts/t2fm/man/t2fm.1
  gzip --force scripts/tawk/man/t2nfdump.1
  gzip --force scripts/tawk/man/tawk.1
}

package() {
  cd "${pkgname}2-${pkgver}"
  install -d "${pkgdir}/usr/lib/${pkgname}/"
  cp -avR build/plugins "${pkgdir}/usr/lib/${pkgname}/"
  install -Dm755 tranalyzer2/src/tranalyzer -t "${pkgdir}/usr/bin"
  install -Dm755 utils/t2b2t/t2b2t -t "${pkgdir}/usr/bin"
  install -Dm755 utils/t2whois/t2whois -t "${pkgdir}/usr/bin"

  install -Dm644 doc/tutorials/splunk.pdf -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm644 doc/tutorials/custom_plugin.pdf -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm644 doc/documentation.pdf -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm644 scripts/doc/scripts.pdf -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm644 scripts/tawk/doc/tawk.pdf -t "${pkgdir}/usr/share/doc/${pkgname}/tawk"
  install -Dm644 scripts/t2fm/doc/t2fm.pdf -t "${pkgdir}/usr/share/doc/${pkgname}/t2fm"

  install -d "${pkgdir}/usr/share/doc/${pkgname}/plugins"
  for doc in $(ls plugins/*/doc/*.pdf | xargs); do
    install -Dm644 ${doc} -t "${pkgdir}/usr/share/doc/${pkgname}/plugins"
  done

  install -Dm644 tranalyzer2/man/tranalyzer.1.gz -t "${pkgdir}/usr/share/man/man1"
  install -Dm644 scripts/t2conf/man/t2conf.1.gz -t "${pkgdir}/usr/share/man/man1"
  install -Dm644 scripts/t2fm/man/t2fm.1.gz -t "${pkgdir}/usr/share/man/man1"
  install -Dm644 scripts/tawk/man/t2nfdump.1.gz -t "${pkgdir}/usr/share/man/man1"
  install -Dm644 scripts/tawk/man/tawk.1.gz -t "${pkgdir}/usr/share/man/man1"

  rm -rf scripts/tawk/man scripts/t2fm/man scripts/t2conf/man

  install -d "${pkgdir}/usr/share/${pkgname}"
  cp -avR scripts/ "${pkgdir}/usr/share/${pkgname}/"

  install -Dm644 scripts/completions/* -t "${pkgdir}/usr/share/bash-completion/completions/"
  install -Dm644 scripts/completions/* -t "${pkgdir}/usr/share/zsh/site-functions/"
  install -Dm644 scripts/t2_aliases -t "${pkgdir}/usr/share/bash-completion/completions/"

  for script in b64ex fpsGplt gpq3x osStat plot_monitoring protStat rrdmonitor rrdplot statGplt t2alive t2caplist t2dmon t2flowstat t2plot t2stat t2timeline t2viz topNStat; do
    ln -s /usr/share/tranalyzer/scripts/${script} "${pkgdir}/usr/bin/"
  done

  ln -s /usr/share/tranalyzer/scripts/tawk/tawk "${pkgdir}/usr/bin/"
  ln -s /usr/share/tranalyzer/scripts/t2fm/t2fm "${pkgdir}/usr/bin/"

  sed -i "641s|.*|T2HOME=/usr/share/tranalyzer|" "${pkgdir}/usr/share/${pkgname}/scripts/t2utils.sh"
  # sed -i '114,133d' "${pkgdir}/usr/share/${pkgname}/scripts/t2doc"
  # sed -i "88s|.*|folder=\"/usr/share/doc/tranalyzer/\$name/\"|" "${pkgdir}/usr/share/${pkgname}/scripts/t2doc"
  # sed -i "82s|.*|folder=\"/usr/share/doc/tranalyzer/\"|" "${pkgdir}/usr/share/${pkgname}/scripts/t2doc"
  # sed -i "79s|.*|folder=\"/usr/share/doc/tranalyzer/\"|" "${pkgdir}/usr/share/${pkgname}/scripts/t2doc"
  # sed -i "91s|.*|folder=\"/usr/share/doc/tranalyzer/plugins/\"|" "${pkgdir}/usr/share/${pkgname}/scripts/t2doc"
}
# vim:set ts=2 sw=2 et: