aboutsummaryrefslogtreecommitdiffstats
path: root/community/cacti
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-03-28 13:54:43 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-03-28 18:38:20 +0200
commit4272e802a1be191657becb739e6a248c1d0411a7 (patch)
treea07a25b7c99d7da326957a88173ba49583cf6b2a /community/cacti
parent3e272105092cd9804a5a022a188db929ebf440da (diff)
downloadaports-4272e802a1be191657becb739e6a248c1d0411a7.tar.bz2
aports-4272e802a1be191657becb739e6a248c1d0411a7.tar.xz
community/*: move php5 and dependent pkgs from main
There two main reasons for this change: * Active support of PHP 5.x ended on January 2017, security support will end on December 2018. Packages in the main repository should be supported for at least 2 years, this means until first quarter of 2019 for the upcoming v3.6. * php7 and its extensions are currently in the community repository, so we can't use single abuild for both php5-* and php7-* packages (as we do for Python and Lua packages). This change was suggested by @vakartel, approved by @ncopa, @kaniini, and @jirutka.
Diffstat (limited to 'community/cacti')
-rw-r--r--community/cacti/APKBUILD145
-rw-r--r--community/cacti/cacti-setup.post-install21
-rw-r--r--community/cacti/cacti.crontab1
-rw-r--r--community/cacti/cacti.nginx.conf36
-rw-r--r--community/cacti/cacti.php-fpm.conf15
-rw-r--r--community/cacti/cacti.pre-install8
6 files changed, 226 insertions, 0 deletions
diff --git a/community/cacti/APKBUILD b/community/cacti/APKBUILD
new file mode 100644
index 0000000000..83a6d33559
--- /dev/null
+++ b/community/cacti/APKBUILD
@@ -0,0 +1,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"
diff --git a/community/cacti/cacti-setup.post-install b/community/cacti/cacti-setup.post-install
new file mode 100644
index 0000000000..e13bcc1f20
--- /dev/null
+++ b/community/cacti/cacti-setup.post-install
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+cat <<EOF
+* Inital setup:
+* 1. create mysql user and database (read manual)
+* 2. change settings in /etc/cacti/config.php
+* 3. configure webserver's site root to /usr/share/webapps/cacti
+* 4. go online (http://$(hostname -f)/cacti/install) to continue setup
+* 5. enjoy :)
+*
+* After setup complete, you can safely remove cacti-setup
+*
+* Partial config for nginx:
+* /usr/share/webapps/cacti/docs/txt/nginx.conf
+*
+* Installation instructions and manual:
+* /usr/share/webapps/cacti/docs/txt/manual.txt
+*
+EOF
+
+exit 0
diff --git a/community/cacti/cacti.crontab b/community/cacti/cacti.crontab
new file mode 100644
index 0000000000..40e2c1ab01
--- /dev/null
+++ b/community/cacti/cacti.crontab
@@ -0,0 +1 @@
+*/5 * * * * php /usr/share/webapps/cacti/poller.php >/dev/null 2>&1
diff --git a/community/cacti/cacti.nginx.conf b/community/cacti/cacti.nginx.conf
new file mode 100644
index 0000000000..3ce5c30f6f
--- /dev/null
+++ b/community/cacti/cacti.nginx.conf
@@ -0,0 +1,36 @@
+#
+# copy this file to /etc/nginx/cacti.conf
+# and include it somewhere to 'server' section
+#
+# server {
+# ...
+# location /cacti {
+# include cacti.conf;
+# }
+# ...
+# }
+#
+root /usr/share/webapps/cacti;
+index index.php;
+
+location ~ \.php$ {
+ fastcgi_pass unix:/var/lib/cacti/socket;
+ include fastcgi.conf;
+}
+
+location ~ /(cli|log|rra|cache/*)/ {
+ deny all;
+}
+
+location ~ /\.ht {
+ deny all;
+}
+
+location ~* \.(ini|sql)$ {
+ deny all;
+}
+
+location ~* \.(ico|png|jpg|jpeg|gif)$ {
+ access_log off;
+ expires 30d;
+}
diff --git a/community/cacti/cacti.php-fpm.conf b/community/cacti/cacti.php-fpm.conf
new file mode 100644
index 0000000000..ff090101f4
--- /dev/null
+++ b/community/cacti/cacti.php-fpm.conf
@@ -0,0 +1,15 @@
+[cacti]
+prefix = /usr/share/webapps/cacti
+
+user = cacti
+group = cacti
+
+listen = /var/lib/cacti/socket
+listen.user = cacti
+listen.group = www-data
+
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
diff --git a/community/cacti/cacti.pre-install b/community/cacti/cacti.pre-install
new file mode 100644
index 0000000000..02e9ad7ad0
--- /dev/null
+++ b/community/cacti/cacti.pre-install
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+addgroup -Sg 82 www-data 2>/dev/null
+
+addgroup -S cacti 2>/dev/null
+adduser -S -D -H -h /var/lib/cacti -s /sbin/nologin -G cacti -g cacti cacti 2>/dev/null
+
+exit 0