archrelease: copy trunk to community-any
[ArchLinux/community.git] / cacti / trunk / PKGBUILD
blob2839ac81667597aec676a4706a0644d955d43c59
1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
3 # Contributor: tuxbubling <tuxbubling@jabber.fr>
5 pkgname=cacti
6 pkgver=1.2.24
7 pkgrel=1
8 pkgdesc="Network graphing solution using RRDTool"
9 arch=(any)
10 url="https://www.cacti.net"
11 license=(GPL2)
12 depends=(php-gd php-snmp rrdtool ttf-dejavu)
13 optdepends=(
14   'mariadb: use local MySQL server'
15   'perl: for scripts'
16   'php-fpm: run in fastCGI process manager'
17   'uwsgi-plugin-php: run as local application container'
19 backup=(
20   etc/webapps/cacti/.htaccess
21   etc/webapps/cacti/config.php
23 source=(
24   https://www.$pkgname.net/downloads/$pkgname-$pkgver.tar.gz
25   $pkgname.uwsgi
26   $pkgname.sysusers
27   $pkgname.tmpfiles
29 install=$pkgname.install
30 sha512sums=('cdc840a39b06fd40fe1fad117af3f28132b5fed295471b8c2138fed41aad8a43b92dbd551b87f88fd7a8823f453d3ce0828558d226ff4206edf50a3f0c96d42f'
31             'ba421785a3a86535dba210b5ac34ad059fac72b809a9027308d047a967de43aa204eda56e129b28f6400859427de123734b338c5d8cd3da1944893fa3ef33e48'
32             '847e2b791de44d0790a2fdb81c77c8af9a66da9d44500f3f8a8d1c0f406d3a20082cc8fef1c6afe4de93ad989d35c79c9809abe14693a9ac6ea74d4696e3b6c1'
33             'e833e411f74e77773c32589ba83cb1b2f28ca9b35931626480ab7daa63420d47ecfc3061e6703323646b69e1d98536b6f3afdd36faa483fb13aac9b818af0c6e')
34 b2sums=('3a6e29c9312862c3e794dd53ce623afd5fbae96d59551f5befbcf64cc21510a9a8263795a9d99a8a5ca719848dc3332a8aa6ce2d4aa49023c4959b59ffda73b7'
35         '880cfc1a87abd95a624ffef6f1ae5ac416b4020ae40edc32355314bb33b5003b21ab8ed082b520d70b166739a1b056339cca7b6a6bb82167c14925ae3ca0d34f'
36         '2ec9956b690ab9244e31a58d295ab56b5d0df9fc9586c74edbd55c12d3383430b8a1a8a708d7d747abadb67eee42094562da510ddfc7797978c2683e7b86a252'
37         '0a532bbbd07b21da18ea21eec3f268510740069fb732e3d387f224b93f0539e3e968ba6332bf647ff62f2d98910abc33e35a3e82d335cf7d29a503609e22651f')
39 prepare() {
40   # adding default .htaccess
41   echo "Require all denied" > $pkgname-htaccess
43   cd $pkgname-$pkgver
44   # setting correct install path for spine
45   sed -e 's|/usr/local/spine/bin/spine|/usr/bin/spine|g' -i install/functions.php
46   # setting correct path for dejavu font
47   sed -e 's|/usr/share/fonts/dejavu/|/usr/share/fonts/TTF/|g' -i lib/rrd.php
48   # remove unneeded executable bits
49   find . -executable -type f -and -not -path "*scripts*" -exec chmod -c 644 {} \;
52 package() {
53   cd $pkgname-$pkgver
55   # install webapp dir
56   install -vdm 755 "$pkgdir/usr/share/webapps/$pkgname/include/"
57   # config
58   install -vDm 640 include/config.php -t "$pkgdir/etc/webapps/$pkgname/"
59   install -vDm 644 ../$pkgname-htaccess "$pkgdir/etc/webapps/$pkgname/.htaccess"
60   ln -sv /etc/webapps/$pkgname/.htaccess "$pkgdir/usr/share/webapps/$pkgname/.htaccess"
61   ln -sv /etc/webapps/$pkgname/config.php "$pkgdir/usr/share/webapps/$pkgname/include/config.php"
62   # state
63   install -vdm 750 "$pkgdir/var/lib/$pkgname/"
64   install -vDm 644 rra/.htaccess -t "$pkgdir/var/lib/$pkgname/rra/"
65   ln -sv /var/lib/$pkgname/rra "$pkgdir/usr/share/webapps/$pkgname/rra"
66   install -vDm 644 resource/index.php -t "$pkgdir/var/lib/$pkgname/resource/"
67   install -vDm 644 resource/snmp_queries/*.{php,xml} -t "$pkgdir/var/lib/$pkgname/resource/snmp_queries/"
68   install -vDm 644 resource/script_server/*.{php,xml} -t "$pkgdir/var/lib/$pkgname/resource/script_server/"
69   install -vDm 644 resource/script_queries/*.{php,xml} -t "$pkgdir/var/lib/$pkgname/resource/script_queries/"
70   ln -sv /var/lib/$pkgname/resource "$pkgdir/usr/share/webapps/$pkgname/resource"
71   install -vDm 644 scripts/*.{php,pl,sh} -t "$pkgdir/var/lib/$pkgname/scripts/"
72   ln -sv /var/lib/$pkgname/scripts "$pkgdir/usr/share/webapps/$pkgname/scripts"
73   # NOTE: add symlinks required for scripts
74   ln -sv /usr/share/webapps/$pkgname/lib "$pkgdir/var/lib/$pkgname/"
75   ln -sv /usr/share/webapps/$pkgname/include "$pkgdir/var/lib/$pkgname/"
76   # cache
77   install -vdm 750 "$pkgdir/var/cache/$pkgname/"
78   install -vDm 644 cache/boost/*.php -t "$pkgdir/var/cache/$pkgname/boost/"
79   install -vDm 644 cache/mibcache/*.php -t "$pkgdir/var/cache/$pkgname/mibcache/"
80   install -vDm 644 cache/realtime/*.php -t "$pkgdir/var/cache/$pkgname/realtime/"
81   install -vDm 644 cache/spikekill/*.php -t "$pkgdir/var/cache/$pkgname/spikekill/"
82   ln -sv /var/cache/$pkgname "$pkgdir/usr/share/webapps/$pkgname/cache"
83   # log
84   install -vdm 750 "$pkgdir/var/log/$pkgname"
85   install -vDm 644 log/.htaccess -t "$pkgdir/var/log/$pkgname"
86   ln -sv /var/log/$pkgname "$pkgdir/usr/share/webapps/$pkgname/log"
87   # docs
88   install -vDm 644 {CHANGELOG,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
89   # tmpfiles.d
90   install -vDm 644 ../$pkgname.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
91   # sysusers.d
92   install -vDm 644 ../$pkgname.sysusers "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
93   # uwsgi config
94   install -vDm 644 ../$pkgname.uwsgi "$pkgdir/etc/uwsgi/$pkgname.ini"
96   # remove already installed files/folder so that they are not installed again
97   rm -frv include/config.php rra/ resource/ scripts/ cache/ log/ {CHANGELOG,README.md}
98   # webapp
99   find . -type f -exec install -vDm 644 {} "$pkgdir/usr/share/webapps/$pkgname/"{} \;