diff options
author | Valery Kartel <valery.kartel@gmail.com> | 2017-02-07 14:16:36 +0200 |
---|---|---|
committer | Leonardo Arena <rnalrd@alpinelinux.org> | 2017-02-08 15:46:55 +0000 |
commit | ba3ed9a280a79501c09ed543b1a8c7c02994996e (patch) | |
tree | 74ecde663ae2f7a32366d0820c6f8803ed2e310e /main/cacti | |
parent | 6a809057966d326cd79647149699d2346b0047f7 (diff) | |
download | aports-ba3ed9a280a79501c09ed543b1a8c7c02994996e.tar.bz2 aports-ba3ed9a280a79501c09ed543b1a8c7c02994996e.tar.xz |
main/cacti: upgrade to 1.0.0
Diffstat (limited to 'main/cacti')
-rw-r--r-- | main/cacti/APKBUILD | 144 | ||||
-rw-r--r-- | main/cacti/cacti-setup.post-install | 20 | ||||
-rw-r--r-- | main/cacti/cacti.nginx.conf | 36 | ||||
-rw-r--r-- | main/cacti/cacti.php-fpm.conf | 15 | ||||
-rw-r--r-- | main/cacti/cacti.pre-install | 9 |
5 files changed, 203 insertions, 21 deletions
diff --git a/main/cacti/APKBUILD b/main/cacti/APKBUILD index 6abe94767d..058cd6f849 100644 --- a/main/cacti/APKBUILD +++ b/main/cacti/APKBUILD @@ -1,38 +1,140 @@ +# Contributor: Valery Kartel <valery.kartel@gmail.com> # Maintainer: Jeff Bilyk <jbilyk@gmail.com> -_php=php5 pkgname=cacti -pkgver=0.8.8h +pkgver=1.0.0 pkgrel=0 -pkgdesc="Network monitoring tool based on RRDtool" +pkgdesc="The complete rrdtool-based graphing solution" url="http://www.cacti.net" arch="noarch" license="GPL2+" -depends="$_php ${_php}-mysql ${_php}-snmp rrdtool net-snmp ${_php}-sockets - ${_php}-xml ${_php}-gd" +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.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 + + # 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 -_builddir="$srcdir"/$pkgname-$pkgver -prepare() { - cd "$_builddir" - for i in $source; do - case $i in - *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; - esac + # 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 } -build() { - cd "$_builddir" - return 0 +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 } -package() { - mkdir -p "$pkgdir"/usr/share/webapps/cacti - mv "$srcdir"/$pkgname-$pkgver/* "$pkgdir"/usr/share/webapps/cacti/ || return 1 +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="e5a2eb9e1b187a92284f46e7d4cd6505 cacti-0.8.8h.tar.gz" -sha256sums="0673bd9513dad381c8bbb9133c721a32bc6422dc91c5a81de16e3cd32e4d0600 cacti-0.8.8h.tar.gz" -sha512sums="11bb0682a7220af5581f42579cf9c38d94aae202425ce15b824849684b1a6778d6f14e6a62ec94c608b7ba06562a825be7fd6d812d0800daa5eb56e640ac1c5f cacti-0.8.8h.tar.gz" + +md5sums="e711a305a12484623669e3c873126348 cacti-1.0.0.tar.gz +8f28596ea23b68b0041680112ebab685 cacti.nginx.conf +b06ea26524a5fb30cfd083cfa0f235a8 cacti.php-fpm.conf" +sha256sums="180a23102af0415b961ef4d4181f93f49d40ebed36c5392ac988650d3753e693 cacti-1.0.0.tar.gz +35bb157b53a11edcb923b91decac7e6468ede9376a109d73037d747165cc38e3 cacti.nginx.conf +f8a5697a4fd8c279d29d383c90b51f0c73311d3ac96d14953ec11f2f7d5bbdb2 cacti.php-fpm.conf" +sha512sums="9133bb3d34ee6a4fe94e8258ce76df1ceac5cc76ccc8a492ae9a1263cbfb765f88f169c2780f2b36c14d8df4607e8effaf448bcb632cd4171533d0f9842550b1 cacti-1.0.0.tar.gz +9b3fe765c6196c0e4988efaa7236d8a8b945725548371b4a0e2a371de374c9577a908d58dcef5a4e59e089ca923cfeb7c5ddea9ee983a5115239052cf9b8ab59 cacti.nginx.conf +695a5e8439ef0ed29068c87b1d711f66c5a24cf31c3c213784f83d6aef8608a07e99bfa2343a6487762572b6022926c3846f704494c7806e9a1aa2c49e18513b cacti.php-fpm.conf" diff --git a/main/cacti/cacti-setup.post-install b/main/cacti/cacti-setup.post-install new file mode 100644 index 0000000000..04e661fd1e --- /dev/null +++ b/main/cacti/cacti-setup.post-install @@ -0,0 +1,20 @@ +#!/bin/sh + +cat <<EOF +* Inital setup: +* 1. configure webserver's site root to /usr/share/webapps/cacti +* 2. create mysql user and database +* 3. change settings in /etc/cacti/config.php +* +* Go online to continue setup +* +* After setup complete, you can safely remove cacti-setup aport +* +* 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/main/cacti/cacti.nginx.conf b/main/cacti/cacti.nginx.conf new file mode 100644 index 0000000000..3ce5c30f6f --- /dev/null +++ b/main/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/main/cacti/cacti.php-fpm.conf b/main/cacti/cacti.php-fpm.conf new file mode 100644 index 0000000000..ff090101f4 --- /dev/null +++ b/main/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/main/cacti/cacti.pre-install b/main/cacti/cacti.pre-install new file mode 100644 index 0000000000..19c56021b5 --- /dev/null +++ b/main/cacti/cacti.pre-install @@ -0,0 +1,9 @@ +#!/bin/sh + +addgroup -S cacti 2>/dev/null +addgroup -Sg 82 www-data 2>/dev/null + +adduser -SDh /var/lib/cacti -s /sbin/nologin -G cacti -g cacti cacti 2>/dev/null +adduser cacti www-data 2>/dev/null + +exit 0 |