Subject: [alpine-aports] [PATCH] main/cacti: add crontab, several fixes

From: Valery Kartel <[email-masked]>
Date: Wed, 15 Feb 2017 12:31:54 +0200

- add crontab job
- fixes in cacti-setup post-install info
- fix pre-install user creation
- do not include user to www-data group

---
 main/cacti/APKBUILD                 |  7 ++++++-
 main/cacti/cacti-setup.post-install | 13 +++++++------
 main/cacti/cacti.crontab            |  1 +
 main/cacti/cacti.pre-install        |  5 ++---
 4 files changed, 16 insertions(+), 10 deletions(-)
 create mode 100644 main/cacti/cacti.crontab

diff --git a/main/cacti/APKBUILD b/main/cacti/APKBUILD
index 058cd6f849..83a6d33559 100644
--- a/main/cacti/APKBUILD
+++ b/main/cacti/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Jeff Bilyk <[email-masked]>
 pkgname=cacti
 pkgver=1.0.0
-pkgrel=0
+pkgrel=1
 pkgdesc="The complete rrdtool-based graphing solution"
 url="http://www.cacti.net"
 arch="noarch"
@@ -16,6 +16,7 @@ subpackages="$pkgname-doc $pkgname-lang $pkgname-setup \
 	"
 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
 	"
@@ -30,6 +31,7 @@ package() {
 		"$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 \
@@ -130,11 +132,14 @@ _php() {
 }
 
 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/main/cacti/cacti-setup.post-install b/main/cacti/cacti-setup.post-install
index 04e661fd1e..e13bcc1f20 100644
--- a/main/cacti/cacti-setup.post-install
+++ b/main/cacti/cacti-setup.post-install
@@ -2,19 +2,20 @@
 
 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
+* 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 :)
 *
-* Go online to continue setup
-*
-* After setup complete, you can safely remove cacti-setup aport
+* 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/main/cacti/cacti.crontab b/main/cacti/cacti.crontab
new file mode 100644
index 0000000000..40e2c1ab01
--- /dev/null
+++ b/main/cacti/cacti.crontab
@@ -0,0 +1 @@
+*/5 * * * * php /usr/share/webapps/cacti/poller.php >/dev/null 2>&1
diff --git a/main/cacti/cacti.pre-install b/main/cacti/cacti.pre-install
index 19c56021b5..02e9ad7ad0 100644
--- a/main/cacti/cacti.pre-install
+++ b/main/cacti/cacti.pre-install
@@ -1,9 +1,8 @@
 #!/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
+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
-- 
2.11.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---