initial import
This commit is contained in:
59
mailgraph/PKGBUILD
Normal file
59
mailgraph/PKGBUILD
Normal file
@@ -0,0 +1,59 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgname=mailgraph
|
||||
pkgver=1.14
|
||||
_debver=$pkgver
|
||||
_debrel=17
|
||||
pkgrel=1
|
||||
pkgdesc="A very simple, free and libre mail statistics RRDtool frontend for Postfix and Sendmail"
|
||||
url='https://mailgraph.schweikert.ch/'
|
||||
arch=('any')
|
||||
license=('GPL-2')
|
||||
options=(emptydirs)
|
||||
install=$pkgname.install
|
||||
depends=('rrdtool' 'perl-file-tail')
|
||||
makedepends=('quilt')
|
||||
source=("https://mailgraph.schweikert.ch/pub/${pkgname}-${pkgver}.tar.gz"
|
||||
"https://deb.debian.org/debian/pool/main/m/mailgraph/mailgraph_${_debver}-${_debrel}.debian.tar.xz"
|
||||
"$pkgname.initd"
|
||||
"$pkgname.confd")
|
||||
sha512sums=('3df0dae010ad166a157eb34a8b1fcf837ab42445d417855ea58937a75b74ca55c06044eefb6077a6117073c39a087bcdf5f58fe35c0e4d9c7d6b18bded7a0193'
|
||||
'8056d3e0209a1bd2e638030cf170197613081242b952fb04bc37382459f2a92ce60e1ec266762e170f6c9194dec76acd5c689b1fcdc7ffba0224b17fdab3d886'
|
||||
'cd72766b972a13266ef03ada96dfd2aa5f49d95cc357d5683a860c6a10dfc318569a6547086861cd9448b5caf687fd9e0669e4a461d0ad13f1a71c2e8868c032'
|
||||
'35efe24ea8f21b966fc50fe352f0f002a5cb9bacf7b5a6ddc653faf0bda97f1bc5b56ccf80ed6ac7ef2b6f67f7a18ad7a88862d44bd1607a9a8cc220f5feb7d2')
|
||||
|
||||
prepare() {
|
||||
cd "$srcdir/$pkgname-$pkgver"
|
||||
|
||||
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
quilt push -av
|
||||
fi
|
||||
|
||||
sed -i "s:mailgraph.rrd:/var/lib/mailgraph/mailgraph.rrd:" mailgraph.cgi
|
||||
sed -i "s:mailgraph_virus.rrd:/var/lib/mailgraph/mailgraph_virus.rrd:" mailgraph.cgi
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir/$pkgname-$pkgver"
|
||||
|
||||
#CGI_DIR=`grep 'ScriptAlias /cgi-bin/' /etc/httpd/conf/httpd.conf | awk '{print $3}' | sed 's|"||g'`
|
||||
CGI_DIR="/usr/share/webapps/mailgraph"
|
||||
|
||||
install -D -m755 mailgraph.pl "$pkgdir/usr/sbin/mailgraph"
|
||||
install -D -m755 mailgraph.cgi "$pkgdir/$CGI_DIR/mailgraph.cgi"
|
||||
install -D -m755 mailgraph.css "$pkgdir/$CGI_DIR/mailgraph.css"
|
||||
|
||||
install -Dm 644 "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname"
|
||||
install -Dm 755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
|
||||
|
||||
install -d -m755 "$pkgdir/var/"{lib/,log/}mailgraph
|
||||
|
||||
install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/$pkgname"
|
||||
}
|
||||
18
mailgraph/mailgraph.confd
Normal file
18
mailgraph/mailgraph.confd
Normal file
@@ -0,0 +1,18 @@
|
||||
# Copyright 1999-2005 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# 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="/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"
|
||||
35
mailgraph/mailgraph.initd
Normal file
35
mailgraph/mailgraph.initd
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2011 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
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}"
|
||||
|
||||
# create /run/mailgraph if necessary
|
||||
if [ ! -d /run/mailgraph ] ; then
|
||||
checkpath -q -d -o mgraph:adm -m 0775 /run/mailgraph || return 1
|
||||
fi
|
||||
|
||||
UMASK=$(umask)
|
||||
umask ${MG_DAEMON_UMASK:-0077}
|
||||
start-stop-daemon --start \
|
||||
--name mailgraph \
|
||||
--user "${MG_DAEMON_UID}:${MG_DAEMON_GID}" \
|
||||
--name mailgraph \
|
||||
--pidfile ${MG_DAEMON_PID} \
|
||||
--exec /usr/sbin/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 $?
|
||||
}
|
||||
18
mailgraph/mailgraph.install
Normal file
18
mailgraph/mailgraph.install
Normal file
@@ -0,0 +1,18 @@
|
||||
post_install() {
|
||||
if ! getent passwd mgraph &>/dev/null; then
|
||||
useradd -r -d /var/lib/mailgraph -g adm -s /bin/false mgraph
|
||||
fi
|
||||
|
||||
chown -R mgraph:adm /var/lib/mailgraph
|
||||
chown -R mgraph:adm /var/log/mailgraph
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install $1
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
if getent passwd mgraph &>/dev/null; then
|
||||
userdel mgraph >/dev/null
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user