Use ebuild by Wolfram Schlich <wschlich at gentoo.org>, bug #149175 for 1.13. This...
authorAndrej Kacian <ticho@gentoo.org>
Sun, 1 Apr 2007 19:30:00 +0000 (19:30 +0000)
committerAndrej Kacian <ticho@gentoo.org>
Sun, 1 Apr 2007 19:30:00 +0000 (19:30 +0000)
Package-Manager: portage-2.1.2.3

net-mail/mailgraph/ChangeLog
net-mail/mailgraph/Manifest
net-mail/mailgraph/files/mailgraph.confd-new [new file with mode: 0644]
net-mail/mailgraph/files/mailgraph.initd-new [new file with mode: 0644]
net-mail/mailgraph/files/mailgraph.logrotate-new [new file with mode: 0644]
net-mail/mailgraph/mailgraph-1.13.ebuild

index 4d79233d9c376386aaf951d2fa1af8846f24a9e8..1b350b90f698380c2af4cfd28bdcbeb743c691f1 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for net-mail/mailgraph
 # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-mail/mailgraph/ChangeLog,v 1.18 2007/04/01 18:36:39 ticho Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-mail/mailgraph/ChangeLog,v 1.19 2007/04/01 19:30:00 ticho Exp $
+
+  01 Apr 2007; Andrej Kacian <ticho@gentoo.org> +files/mailgraph.confd-new,
+  +files/mailgraph.initd-new, +files/mailgraph.logrotate-new,
+  mailgraph-1.13.ebuild:
+  Use ebuild by Wolfram Schlich <wschlich at gentoo.org>, bug #149175 for
+  1.13. This makes mailgraph not run as root.
 
 *mailgraph-1.13 (01 Apr 2007)
 
index 112c85773eb9d91f74a5506225e650b525cce1e4..90fd27221ae9940fbf2e2b49b70c2b802e819134 100644 (file)
@@ -5,24 +5,36 @@ AUX mailgraph.confd 476 RMD160 39bf249be23c1336f3ad3dc9eaefc7ce3e31b11b SHA1 497
 MD5 fa47226fdde5601a3b0ae0d19377019f files/mailgraph.confd 476
 RMD160 39bf249be23c1336f3ad3dc9eaefc7ce3e31b11b files/mailgraph.confd 476
 SHA256 9c26a668322a34d433a2a3e4ce250a8d78f51534e6b1d392263560887c17d88a files/mailgraph.confd 476
+AUX mailgraph.confd-new 764 RMD160 579dd58dd2c2a2103236ed3b5b3dccdbdd8d3ba7 SHA1 3ab3f965e25e70853d7631314c3c1826156a188a SHA256 86b970df1bbb3a4e85226ce6036a228b2ff155db88124b49bc07e08f022ac1d2
+MD5 666a32e7ad7a97de7f13255651392793 files/mailgraph.confd-new 764
+RMD160 579dd58dd2c2a2103236ed3b5b3dccdbdd8d3ba7 files/mailgraph.confd-new 764
+SHA256 86b970df1bbb3a4e85226ce6036a228b2ff155db88124b49bc07e08f022ac1d2 files/mailgraph.confd-new 764
 AUX mailgraph.initd 688 RMD160 2b48ef4bc386ba19c9b83b9e25ce7517ae9b7908 SHA1 41f29fc729c3594e2ee8199762582c8d1b5be709 SHA256 7fdb517fa070a5d4d9c27fda25b36e915fa51999ac31e4877a76bd1abad21753
 MD5 8c03fcc4cff6db35f4fce26f1eaadf3a files/mailgraph.initd 688
 RMD160 2b48ef4bc386ba19c9b83b9e25ce7517ae9b7908 files/mailgraph.initd 688
 SHA256 7fdb517fa070a5d4d9c27fda25b36e915fa51999ac31e4877a76bd1abad21753 files/mailgraph.initd 688
+AUX mailgraph.initd-new 866 RMD160 2b3962945a0ba4fd46f944e32cfaec31aba0cc88 SHA1 06c6c88b7651fad52503493802410d148840129e SHA256 8c58ed08a89ab2f3d5c262158de68b5934213c1b9fe19043a36c49d43d26436e
+MD5 ec8f139351f6992b254cf9427ae7ca1f files/mailgraph.initd-new 866
+RMD160 2b3962945a0ba4fd46f944e32cfaec31aba0cc88 files/mailgraph.initd-new 866
+SHA256 8c58ed08a89ab2f3d5c262158de68b5934213c1b9fe19043a36c49d43d26436e files/mailgraph.initd-new 866
+AUX mailgraph.logrotate-new 895 RMD160 62bac0366f91949747b2234b56d9a7bf61e5e47d SHA1 b7e4741bfac3021b6fcf5ce8911ec5a25b11c7f8 SHA256 3e1241e1d209a4679fe1f2f3d45716858acb1c0f1daac4b6709d9cb9d8564504
+MD5 eb4e3b1ab15a3d1a82b96b52efca4d08 files/mailgraph.logrotate-new 895
+RMD160 62bac0366f91949747b2234b56d9a7bf61e5e47d files/mailgraph.logrotate-new 895
+SHA256 3e1241e1d209a4679fe1f2f3d45716858acb1c0f1daac4b6709d9cb9d8564504 files/mailgraph.logrotate-new 895
 DIST mailgraph-1.12.tar.gz 20053 RMD160 37111b29e4519010f102c71306ba6b896082cb6f SHA1 08bbe7f6e66f1b14b40ce7da8caa716b6ee122e3 SHA256 7ff3b56654fef85180abcece7d4ae42ac173a0815d728ae1c406c8e48dc56e7c
 DIST mailgraph-1.13.tar.gz 21322 RMD160 8c4e393e548b99a49da4f35c8b8a104d5bf14339 SHA1 12a7aaca0c7819b2d617485a13832e4dcd706570 SHA256 f08476371b59b1e2313b388e962e6ff968432d4b66520c11e8b05ff7e968c6c8
 EBUILD mailgraph-1.12.ebuild 1410 RMD160 1da369b6d6761744f42b5d0962c29c6959e86d0b SHA1 ff1b1a6fc82f900a3764f08da171a5d46853034e SHA256 5c8f2b300b03b936be3e41239859985a70911299993a35cf63115b74084bbc7c
 MD5 7a86dbac9639c79b3df4bc1d17614f09 mailgraph-1.12.ebuild 1410
 RMD160 1da369b6d6761744f42b5d0962c29c6959e86d0b mailgraph-1.12.ebuild 1410
 SHA256 5c8f2b300b03b936be3e41239859985a70911299993a35cf63115b74084bbc7c mailgraph-1.12.ebuild 1410
-EBUILD mailgraph-1.13.ebuild 1379 RMD160 eeefb643d03a86f018ed57e81df7226bdefd518f SHA1 16310b4ca05bbd80763c21ba1ecb2a9a35237f57 SHA256 3d11a912b12fcdb68679d0917ccb6e87c2654d77398fbee6cff61de6a55d4e62
-MD5 2f317f99c575511cab2bb5edcef75aa3 mailgraph-1.13.ebuild 1379
-RMD160 eeefb643d03a86f018ed57e81df7226bdefd518f mailgraph-1.13.ebuild 1379
-SHA256 3d11a912b12fcdb68679d0917ccb6e87c2654d77398fbee6cff61de6a55d4e62 mailgraph-1.13.ebuild 1379
-MISC ChangeLog 2764 RMD160 a98a8c3fd281b15456e8d79459f493dad19dd543 SHA1 ee55886f27a2c22e0dc3dcdeed9cb7c57e8b51ec SHA256 dc807d1b2e34a1312c0c0159b0b0a2a9b4cade9b0e5f291e30676e5cf0214913
-MD5 c233dcd0d4be7060ecfc9b2a77309ab5 ChangeLog 2764
-RMD160 a98a8c3fd281b15456e8d79459f493dad19dd543 ChangeLog 2764
-SHA256 dc807d1b2e34a1312c0c0159b0b0a2a9b4cade9b0e5f291e30676e5cf0214913 ChangeLog 2764
+EBUILD mailgraph-1.13.ebuild 4229 RMD160 dc3ecbe708a33e93d999fbfe22a9b388c9e4ba9f SHA1 69daaf4665e8c8d2d5b3c9155867bb82379d8f02 SHA256 eb17ac8bb7f06caafd8e82955c259207c6c0d3f693b27dfb2795d12a9ace05fc
+MD5 0abdab52b12e60620e8b583533d8f424 mailgraph-1.13.ebuild 4229
+RMD160 dc3ecbe708a33e93d999fbfe22a9b388c9e4ba9f mailgraph-1.13.ebuild 4229
+SHA256 eb17ac8bb7f06caafd8e82955c259207c6c0d3f693b27dfb2795d12a9ace05fc mailgraph-1.13.ebuild 4229
+MISC ChangeLog 3048 RMD160 79dee50901f2a9756069bcdbe40566eb9461eed5 SHA1 99111944cc63bbe9cc416e7b871f39009e837394 SHA256 152614293df5397d83b3579b3dd95151726a0cae892b2d13a17eeb560a12fd88
+MD5 40571383d9767d7da1ff4b4b4a1ab975 ChangeLog 3048
+RMD160 79dee50901f2a9756069bcdbe40566eb9461eed5 ChangeLog 3048
+SHA256 152614293df5397d83b3579b3dd95151726a0cae892b2d13a17eeb560a12fd88 ChangeLog 3048
 MISC metadata.xml 163 RMD160 9d7831690071ef6a890ce066c38c9c4e851a2107 SHA1 6dcd4fa8a9b5cfcc7c0ae80c09e43395fe8e71a7 SHA256 38427b537ef2f561a685876ae3a7799382a1bf7fabef6c2d8765ca9d05056aa2
 MD5 5da9e4b96f6f03e46d0e498b183b26de metadata.xml 163
 RMD160 9d7831690071ef6a890ce066c38c9c4e851a2107 metadata.xml 163
@@ -36,7 +48,7 @@ SHA256 fbbfbe00e02a107e35ed58d2ff51efd799afa13820c1662e602a77e037da2ea4 files/di
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.7 (GNU/Linux)
 
-iD8DBQFGD/u9QlM6RnzZP+IRAkonAJ4qJfZgfX7XknrTqbCP9HFD/1lmTwCffHFf
-bMO4cpwoIoRJ9XHaDLIBSr8=
-=y/cm
+iD8DBQFGEAg+QlM6RnzZP+IRAjMYAKCGJ7Xz0H/N5Nj0MJxo55zt9C1djQCePuef
+xOC4P64yiBTtR9sTT2/HMRE=
+=GY81
 -----END PGP SIGNATURE-----
diff --git a/net-mail/mailgraph/files/mailgraph.confd-new b/net-mail/mailgraph/files/mailgraph.confd-new
new file mode 100644 (file)
index 0000000..8ac31ca
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-mail/mailgraph/files/mailgraph.confd-new,v 1.1 2007/04/01 19:30:00 ticho Exp $
+
+# Location of logfile that all (!) mail software (MTA, spamfilter etc.) logs to.
+# mailgraph defaults to /var/log/syslog if unspecified
+MG_LOGFILE="/var/log/messages"
+
+# Required daemon settings
+MG_DAEMON_UID="mgraph"
+MG_DAEMON_GID="adm"
+MG_DAEMON_UMASK="0022"
+MG_DAEMON_LOG="/var/log/mailgraph/mailgraph.log"
+MG_DAEMON_PID="/var/run/mailgraph/mailgraph.pid"
+MG_DAEMON_RRD="/var/lib/mailgraph"
+
+# Specify any extra options here.
+# If MG_LOGFILE is in metalog format, add "-t metalog" to MG_DAEMON_OPTS
+MG_DAEMON_OPTS="--ignore-localhost"
diff --git a/net-mail/mailgraph/files/mailgraph.initd-new b/net-mail/mailgraph/files/mailgraph.initd-new
new file mode 100644 (file)
index 0000000..57b20cb
--- /dev/null
@@ -0,0 +1,28 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-mail/mailgraph/files/mailgraph.initd-new,v 1.1 2007/04/01 19:30:00 ticho Exp $
+
+start() {
+       ebegin "Starting mailgraph"
+
+       # read mail log messages somewhere other than /var/log/syslog?
+       [[ -n "${MG_LOGFILE}" ]] && MG_DAEMON_OPTS="${MG_DAEMON_OPTS} -l ${MG_LOGFILE}"
+
+       UMASK=$(umask)
+       umask ${MG_DAEMON_UMASK:-0077}
+       start-stop-daemon --start \
+               -c "${MG_DAEMON_UID}:${MG_DAEMON_GID}" \
+               --exec /usr/bin/mailgraph -- -v --daemon \
+               --daemon-log="${MG_DAEMON_LOG}" \
+               --daemon-pid="${MG_DAEMON_PID}" \
+               --daemon-rrd=/var/lib/mailgraph ${MG_DAEMON_OPTS}
+       eend $?
+       umask "${UMASK}"
+}
+
+stop() {
+       ebegin "Shutting down mailgraph"
+       start-stop-daemon --stop --quiet --pidfile "${MG_DAEMON_PID}"
+       eend $?
+}
diff --git a/net-mail/mailgraph/files/mailgraph.logrotate-new b/net-mail/mailgraph/files/mailgraph.logrotate-new
new file mode 100644 (file)
index 0000000..0049b8b
--- /dev/null
@@ -0,0 +1,31 @@
+# $Header: /var/cvsroot/gentoo-x86/net-mail/mailgraph/files/mailgraph.logrotate-new,v 1.1 2007/04/01 19:30:00 ticho Exp $
+# logrotate config for mailgraph log
+
+/var/log/mailgraph/mailgraph.log {
+       ## rotate daily
+       daily
+       ## keep 30 old copies
+       rotate 30
+       ## use .YYYYMMDD instead of .0,.1,.2 etc.
+       dateext
+       ## also rotate empty logfiles to strictly retain chronology
+       ifempty
+       ## re-create source logfile with original permissions
+       ## do NOT use copy or copytruncate!
+       create
+       ## compress on next logrotate run (e.g. next day) to give
+       ## programs the chance to close the old logfile
+       delaycompress
+       ## compress logfiles
+       compress
+       compresscmd /bin/gzip
+       compressoptions -9
+       uncompresscmd /bin/gunzip
+       ## don't throw an error when a file doesn't exist
+       missingok
+       ## restart mailgraph after rotating all logfiles
+       sharedscripts
+       postrotate
+               /etc/init.d/mailgraph restart >/dev/null
+       endscript
+}
index 1428ccd9849d1332c91183f1ab290c392ca207dc..5bec1535c32a727de68d4f56f4b775c6bb7a9eca 100644 (file)
@@ -1,27 +1,37 @@
 # Copyright 1999-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-mail/mailgraph/mailgraph-1.13.ebuild,v 1.1 2007/04/01 18:36:39 ticho Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-mail/mailgraph/mailgraph-1.13.ebuild,v 1.2 2007/04/01 19:30:00 ticho Exp $
 
 inherit eutils webapp
 
 DESCRIPTION="A mail statistics RRDtool frontend for Postfix"
-HOMEPAGE="http://mailgraph.schweikert.ch"
-SRC_URI="http://mailgraph.schweikert.ch/pub/${P}.tar.gz"
+HOMEPAGE="http://mailgraph.schweikert.ch/"
+SRC_URI="http://mailgraph.schweikert.ch//pub/${P}.tar.gz"
 
 LICENSE="GPL-2"
 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
-IUSE=""
+IUSE="logrotate"
 
 RDEPEND="dev-lang/perl
        dev-perl/File-Tail
-       >=net-analyzer/rrdtool-1.2.2"
-DEPEND=">=sys-apps/sed-4
-       >=net-analyzer/rrdtool-1.2.2"
+       >=net-analyzer/rrdtool-1.2.2
+       logrotate? ( app-admin/logrotate )"
+DEPEND=">=sys-apps/sed-4"
+
+user_group_setup() {
+       # add user and group for mailgraph daemon
+       # also add mgraph to the group adm so it's able to
+       # read syslog logfile /var/log/messages (should be owned by
+       # root:adm with permission 0640)
+       enewgroup mgraph
+       enewuser mgraph -1 -1 /var/empty mgraph,adm
+}
 
 pkg_setup() {
        webapp_pkg_setup
        built_with_use net-analyzer/rrdtool perl \
                || die "net-analyzer/rrdtool must be built with USE=perl"
+       user_group_setup
 }
 
 src_unpack() {
@@ -33,12 +43,41 @@ src_unpack() {
                mailgraph.cgi || die "sed mailgraph.cgi failed"
 }
 
+pkg_preinst() {
+       user_group_setup
+}
+
 src_install() {
        webapp_src_preinst
+       # be sure to run webapp_src_install *before* doing the directories below
+       # because it cripples all other permissions :-(
+       webapp_src_install
 
        # for the RRDs
+       dodir /var/lib
+       diropts -omgraph -gmgraph -m0750
+       dodir /var/lib/mailgraph
        keepdir /var/lib/mailgraph
 
+       # log and pid file
+       diropts ""
+       dodir /var/log
+       dodir /var/run
+       diropts -omgraph -gadm -m0750
+       dodir /var/log/mailgraph
+       keepdir /var/log/mailgraph
+       dodir /var/run/mailgraph
+       keepdir /var/run/mailgraph
+
+       if use logrotate ; then
+               # logrotate config for mailgraph log
+               diropts ""
+               dodir /etc/logrotate.d
+               insopts -m0644
+               insinto /etc/logrotate.d
+               newins ${FILESDIR}/mailgraph.logrotate-new mailgraph
+       fi
+
        # mailgraph daemon
        newbin mailgraph.pl mailgraph
 
@@ -47,11 +86,64 @@ src_install() {
        doexe mailgraph.cgi
 
        # init/conf files for mailgraph daemon
-       newinitd ${FILESDIR}/mailgraph.initd mailgraph
-       newconfd ${FILESDIR}/mailgraph.confd mailgraph
+       newinitd ${FILESDIR}/mailgraph.initd-new mailgraph
+       newconfd ${FILESDIR}/mailgraph.confd-new mailgraph
 
        # docs
-       dodoc README CHANGES
+       dodoc README CHANGES COPYING
+}
 
-       webapp_src_install
+pkg_postinst() {
+       # Fix ownerships - previous versions installed these with
+       # root as owner
+       if [[ has_version <=net-mail/mailgraph-1.12 ]] ; then
+               if [[ -d /var/lib/mailgraph ]] ; then
+                       chown mgraph:mgraph /var/lib/mailgraph
+               fi
+               if [[ -d /var/log/mailgraph ]] ; then
+                       chown mgraph:adm /var/log/mailgraph
+               fi
+               if [[ -d /var/run/mailgraph ]] ; then
+                       chown mgraph:adm /var/run/mailgraph
+               fi
+       fi
+       einfo ""
+       einfo "Mailgraph will run as user mgraph with group adm by default."
+       einfo "This can be changed in /etc/conf.d/mailgraph if it doesn't fit."
+       einfo "Remember to adjust MG_DAEMON_LOG, MG_DAEMON_PID and MG_DAEMON_RRD"
+       einfo "as well!"
+       einfo ""
+       echo
+       ewarn ""
+       ewarn "Please make sure the MG_LOGFILE (default: /var/log/messages) is readable"
+       ewarn "by group adm or change MG_DAEMON_GID in /etc/conf.d/mailgraph accordingly!"
+       ewarn ""
+       ewarn "Please make sure *all* mail related logs (MTA, spamfilter, virus scanner)"
+       ewarn "go to the file /var/log/messages or change MG_LOGFILE in"
+       ewarn "/etc/conf.d/mailgraph accordingly! Otherwise mailgraph won't get to know"
+       ewarn "the corresponding events (virus/spam mail found etc.)."
+       ewarn ""
+       echo
+       einfo
+       einfo "Checking for user apache"
+       if egetent passwd apache >&/dev/null; then
+               einfo
+               einfo "Adding user apache to group mgraph so the included"
+               einfo "CGI script is able to read the mailgraph RRD files"
+               einfo
+               if ! gpasswd -a apache mgraph >&/dev/null; then
+                       eerror "Failed to add user apache to group mgraph!"
+                       eerror "Please check manually."
+               fi
+       else
+               einfo
+               einfo "User apache not found, maybe we will be running a"
+               einfo "webserver with a different UID?"
+               einfo "If that's the case, please add that user to the"
+               einfo "group mgraph manually to enable the included"
+               einfo "CGI script to read the mailgraph RRD files:"
+               einfo
+               einfo "\tgpasswd -a <user> mgraph"
+               einfo
+       fi
 }