Subject: Re: [alpine-aports] [PATCH v2] main/cacti: upgrade to 1.0.0

From: Valery Kartel <[email-masked]>
Date: Tue, 7 Feb 2017 12:50:00 +0200

yes, it's a good idea. I'll make a new patch later

7 февр. 2017 г. 12:01 пользователь "Leonardo Arena" <[email-masked]>
написал:

Hi,

On ven, 2017-02-03 at 18:49 +0200, Valery Kartel wrote:
> ---
> v1:
>
> create user 'cacti' for php and cli operations
> move writable data to cacti's home /var/lib/cacti
> move all documentaion to -doc
> move installation-related data to -inst subpackage
> add -php5 & -php7 subpackages for autoinstall php dependencies
> fix net-snmp dependency -> net-snmp-tools
> add dependency for cacti-scripts: bash, perl
> ---
> v1 -> v2:
>
> add dependency for cacti-scripts: coreutils
> add system ttf-dejavu font instead of bundled one
> move all localisations to -lang subpackage
> rename -inst to -setup and add post-install setup message
> add partial config for nginx (in -doc)
> add config for php-fpm pool (in -php*)
> ---
>  main/cacti/APKBUILD                 | 136
> ++++++++++++++++++++++++++++++------
>  main/cacti/cacti-setup.post-install |  20 ++++++
>  main/cacti/cacti.nginx.conf         |  36 ++++++++++
>  main/cacti/cacti.php-fpm.conf       |  15 ++++
>  main/cacti/cacti.pre-install        |   9 +++
>  5 files changed, 195 insertions(+), 21 deletions(-)
>  create mode 100644 main/cacti/cacti-setup.post-install
>  create mode 100644 main/cacti/cacti.nginx.conf
>  create mode 100644 main/cacti/cacti.php-fpm.conf
>  create mode 100644 main/cacti/cacti.pre-install
>
> diff --git a/main/cacti/APKBUILD b/main/cacti/APKBUILD
> index 6abe94767d..ea31d21db4 100644
> --- a/main/cacti/APKBUILD
> +++ b/main/cacti/APKBUILD
> @@ -1,38 +1,132 @@
> +# Contributor: Valery Kartel <[email-masked]>
>  # Maintainer: Jeff Bilyk <[email-masked]>
> -_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
> +
> +     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
> +
> +     # 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 log 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 config to cacti's home
> +     mv "$pkgdir"/usr/share/webapps/$pkgname/include/config.php \
> +             "$pkgdir"/var/lib/$pkgname/config.php || return 1
> +     ln -s /var/lib/$pkgname/config.php \
> +             "$pkgdir"/usr/share/webapps/$pkgname/include/config.
> php
> +}
>

can the configuration be moved into /etc/cacti, so that it goes into
LBU by default?

We do this already with other web packages like roundcube, nextcloud,
etc.

|_eo