blob: 83a6d335597e9fe9824989e5d2a618badc920cea (
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Jeff Bilyk <jbilyk@gmail.com>
pkgname=cacti
pkgver=1.0.0
pkgrel=1
pkgdesc="The complete rrdtool-based graphing solution"
url="http://www.cacti.net"
arch="noarch"
license="GPL2+"
pkgusers="cacti"
pkggroups="www-data"
depends="bash perl coreutils net-snmp-tools rrdtool ttf-dejavu"
makedepends=""
subpackages="$pkgname-doc $pkgname-lang $pkgname-setup \
$pkgname-php5:_php $pkgname-php7:_php
"
install="$pkgname.pre-install $pkgname-setup.post-install"
source="http://www.cacti.net/downloads/$pkgname-$pkgver.tar.gz
$pkgname.crontab
$pkgname.nginx.conf
$pkgname.php-fpm.conf
"
builddir="$srcdir/$pkgname-$pkgver"
package() {
cd "$builddir"
mkdir -p "$pkgdir"/usr/share/webapps/$pkgname \
"$pkgdir"/var/lib/$pkgname \
"$pkgdir"/etc/$pkgname \
"$pkgdir"/var/log
cp -r * "$pkgdir"/usr/share/webapps/$pkgname/ || return 1
install -Dm600 "$srcdir"/$pkgname.crontab "$pkgdir"/etc/crontabs/$pkgname
# remove development data
rm -fr "$pkgdir"/usr/share/webapps/$pkgname/locales/po \
"$pkgdir"/usr/share/webapps/$pkgname/locales/update-pot.sh
# switch to system fonts
rm -fr "$pkgdir"/usr/share/webapps/$pkgname/include/fonts
ln -s /usr/share/fonts/ttf-dejavu \
"$pkgdir"/var/lib/$pkgname/fonts
ln -s /var/lib/$pkgname/fonts \
"$pkgdir"/usr/share/webapps/$pkgname/include/fonts
# symlink to help webserver find relative path
ln -s . "$pkgdir"/usr/share/webapps/$pkgname/$pkgname
# move variable and writable data to cacti's home
local dir; for dir in cache plugins resource rra scripts; do
mv "$pkgdir"/usr/share/webapps/$pkgname/$dir \
"$pkgdir"/var/lib/$pkgname/$dir || return 1
chown -R $pkgusers:$pkggroups "$pkgdir"/var/lib/$pkgname/$dir
ln -s /var/lib/$pkgname/$dir "$pkgdir"/usr/share/webapps/$pkgname/$dir
done
# move log to /var/log
mv "$pkgdir"/usr/share/webapps/$pkgname/log \
"$pkgdir"/var/log/$pkgname || return 1
chown -R $pkgusers:$pkggroups "$pkgdir"/var/log/$pkgname
ln -s /var/log/$pkgname "$pkgdir"/usr/share/webapps/$pkgname/log
# move config to /etc
mv "$pkgdir"/usr/share/webapps/$pkgname/include/config.php \
"$pkgdir"/etc/$pkgname/config.php || return 1
ln -s /etc/$pkgname/config.php \
"$pkgdir"/usr/share/webapps/$pkgname/include/config.php
}
doc() {
default_doc || return 1
mkdir -p "$subpkgdir"/usr/share/webapps/$pkgname
cd "$pkgdir"/usr/share/webapps/$pkgname
mv docs "$subpkgdir"/usr/share/webapps/$pkgname/
local file;
for file in $(find ./ -name "LICENSE" -o -name "NEWS" \
-o -name "README*" -o -name "VERSION" \
-o -name "CHANGELOG" -o -name "*.rst")
do
mkdir -p "$subpkgdir"/usr/share/webapps/$pkgname/${file%/*}
mv $file "$subpkgdir"/usr/share/webapps/$pkgname/$file
done
install -Dm644 "$srcdir"/$pkgname.nginx.conf \
"$subpkgdir"/usr/share/webapps/$pkgname/docs/txt/nginx.conf
}
lang() {
pkgdesc="$pkgdesc (localisations)"
install_if="lang $pkgname=$pkgver-r$pkgrel"
mkdir -p "$subpkgdir"/usr/share/webapps/$pkgname/locales/LC_MESSAGES \
"$subpkgdir"/usr/share/webapps/$pkgname/include/js/LC_MESSAGES \
"$subpkgdir"/usr/share/webapps/$pkgname/include/phpmailer/language
# cacti l10n
mv "$pkgdir"/usr/share/webapps/$pkgname/locales/LC_MESSAGES/* \
"$subpkgdir"/usr/share/webapps/$pkgname/locales/LC_MESSAGES
# jquery l10n
mv "$pkgdir"/usr/share/webapps/$pkgname/include/js/LC_MESSAGES/* \
"$subpkgdir"/usr/share/webapps/$pkgname/include/js/LC_MESSAGES
# phpmailer l10n
mv "$pkgdir"/usr/share/webapps/$pkgname/include/phpmailer/language/*lang*.php \
"$subpkgdir"/usr/share/webapps/$pkgname/include/phpmailer/language
}
setup() {
pkgdesc="$pkgdesc (initial setup)"
depends="$pkgname $pkgname-doc"
mkdir -p "$subpkgdir"/usr/share/webapps/$pkgname
mv "$pkgdir"/usr/share/webapps/$pkgname/install \
"$pkgdir"/usr/share/webapps/$pkgname/*.sql \
"$subpkgdir"/usr/share/webapps/$pkgname/
}
_php() {
local php=${subpkgname#$pkgname-}
pkgdesc="$pkgdesc ($php dependencies)"
install_if="$php-config $pkgname=$pkgver-r$pkgrel"
depends="$php $php-gd $php-gmp $php-json $php-ldap $php-pdo_mysql
$php-openssl $php-posix $php-snmp $php-sockets $php-xml $php-zlib"
# cacti's php-fpm pool config
install -Dm644 "$srcdir"/$pkgname.php-fpm.conf \
"$subpkgdir"/etc/$php/php-fpm.d/$pkgname.conf
}
md5sums="e711a305a12484623669e3c873126348 cacti-1.0.0.tar.gz
213c3aff8cf08438703ae5e544046eae cacti.crontab
8f28596ea23b68b0041680112ebab685 cacti.nginx.conf
b06ea26524a5fb30cfd083cfa0f235a8 cacti.php-fpm.conf"
sha256sums="180a23102af0415b961ef4d4181f93f49d40ebed36c5392ac988650d3753e693 cacti-1.0.0.tar.gz
9cfa7edec4b28722230b7b509cc420958b7864703752bb70c8376282bfc1c5a9 cacti.crontab
35bb157b53a11edcb923b91decac7e6468ede9376a109d73037d747165cc38e3 cacti.nginx.conf
f8a5697a4fd8c279d29d383c90b51f0c73311d3ac96d14953ec11f2f7d5bbdb2 cacti.php-fpm.conf"
sha512sums="9133bb3d34ee6a4fe94e8258ce76df1ceac5cc76ccc8a492ae9a1263cbfb765f88f169c2780f2b36c14d8df4607e8effaf448bcb632cd4171533d0f9842550b1 cacti-1.0.0.tar.gz
70f47dbbca76489fc3a84452ee8065f9571ee627b3e346cd3c866501d723a609372c4fbd7e53c4bdcdb22439d876d78847f8902dfa43f3f66b2329639e795ab9 cacti.crontab
9b3fe765c6196c0e4988efaa7236d8a8b945725548371b4a0e2a371de374c9577a908d58dcef5a4e59e089ca923cfeb7c5ddea9ee983a5115239052cf9b8ab59 cacti.nginx.conf
695a5e8439ef0ed29068c87b1d711f66c5a24cf31c3c213784f83d6aef8608a07e99bfa2343a6487762572b6022926c3846f704494c7806e9a1aa2c49e18513b cacti.php-fpm.conf"
|