summaryrefslogtreecommitdiff
path: root/extra/fetchmail
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /extra/fetchmail
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'extra/fetchmail')
-rw-r--r--extra/fetchmail/PKGBUILD37
-rw-r--r--extra/fetchmail/fetchmail.conf5
-rw-r--r--extra/fetchmail/fetchmail.install20
-rw-r--r--extra/fetchmail/fetchmail.rc41
4 files changed, 103 insertions, 0 deletions
diff --git a/extra/fetchmail/PKGBUILD b/extra/fetchmail/PKGBUILD
new file mode 100644
index 000000000..9463a9277
--- /dev/null
+++ b/extra/fetchmail/PKGBUILD
@@ -0,0 +1,37 @@
+# $Id: PKGBUILD 102917 2010-12-13 01:30:42Z eric $
+# Maintainer: Aaron Griffin <aaron@archlinux.org>
+
+pkgname=fetchmail
+pkgver=6.3.19
+pkgrel=1
+pkgdesc="A remote-mail retrieval utility"
+url="http://fetchmail.berlios.de/"
+arch=('i686' 'x86_64')
+depends=('glibc' 'openssl' 'python2')
+optdepends=('tk: fetchmailconf')
+options=('!makeflags')
+license=('GPL')
+install=fetchmail.install
+source=(http://download2.berlios.de/fetchmail/${pkgname}-${pkgver}.tar.bz2
+ fetchmail.rc fetchmail.conf)
+md5sums=('64519711c8533f5a34d20c9ff620d880' '6742e99d65a827bc2b9d6bc8efe269e6'\
+ '8fcd6a22dfbc247755fdd050c5c5c4d3')
+sha1sums=('fcc9b9299fe147d8f522cff93f8f619e5e1372b7' '13c7e3c538211c79c5b403f2bfa6712a2ad0ac30'\
+ '30401729386d6f774c6c36ab8530842166de54a8')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --with-ssl=/usr
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -Dm755 "${srcdir}/fetchmail.rc" "${pkgdir}/etc/rc.d/fetchmail"
+ install -Dm644 "${srcdir}/fetchmail.conf" "${pkgdir}/etc/conf.d/fetchmail"
+
+ # "home" directory for pid file.
+ install -d -o 90 -g nobody -m700 "${pkgdir}/var/run/fetchmail"
+}
diff --git a/extra/fetchmail/fetchmail.conf b/extra/fetchmail/fetchmail.conf
new file mode 100644
index 000000000..dcac2a067
--- /dev/null
+++ b/extra/fetchmail/fetchmail.conf
@@ -0,0 +1,5 @@
+# Daemon polling interval
+INTERVAL=60
+
+# Config location
+CONFIG=/etc/fetchmailrc
diff --git a/extra/fetchmail/fetchmail.install b/extra/fetchmail/fetchmail.install
new file mode 100644
index 000000000..711cbe568
--- /dev/null
+++ b/extra/fetchmail/fetchmail.install
@@ -0,0 +1,20 @@
+post_install() {
+ # /etc/fetchmail must be owned by fetchmail for daemon to work.
+ echo "If you run fetchmail as a daemon and not a cron job"
+ echo "then 'chown fetchmail /etc/fetchmailrc'"
+ getent passwd fetchmail >/dev/null || usr/sbin/useradd -u 90 -g nobody \
+ -d '/var/run/fetchmail' -c 'Fetchmail daemon' -s /bin/false fetchmail
+}
+
+post_upgrade() {
+ getent passwd fetchmail >/dev/null || usr/sbin/useradd -u 90 -g nobody \
+ -d '/var/run/fetchmail' -c 'Fetchmail daemon' -s /bin/false fetchmail
+
+ if [ "$(vercmp $2 6.3.19)" -lt 0 ] ; then
+ chsh -s /bin/false fetchmail
+ fi
+}
+
+pre_remove() {
+ usr/sbin/userdel fetchmail &>/dev/null
+}
diff --git a/extra/fetchmail/fetchmail.rc b/extra/fetchmail/fetchmail.rc
new file mode 100644
index 000000000..7c25f72b2
--- /dev/null
+++ b/extra/fetchmail/fetchmail.rc
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/fetchmail ] && . /etc/conf.d/fetchmail
+
+PID=`pidof -o %PPID /usr/bin/fetchmail`
+case "$1" in
+ start)
+ stat_busy "Starting fetchmail"
+ [ -z "$PID" ] &&
+ su -c "/usr/bin/fetchmail -d $INTERVAL -f $CONFIG" -s /bin/sh fetchmail
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ #Fetchmail does this for us:
+ #echo $PID > /var/run/fetchmail.pid
+ add_daemon fetchmail
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping fetchmail"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/fetchmail.pid
+ rm_daemon fetchmail
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0