diff options
author | Max Gautier | 2022-06-28 15:15:33 +0200 |
---|---|---|
committer | Max Gautier | 2022-06-28 15:15:33 +0200 |
commit | a877d2c6ab14b332dd23df424cbc8776a09f1cfa (patch) | |
tree | 9605cbb4fb4a875758710d477036670906af1a3e | |
download | aur-a877d2c6ab14b332dd23df424cbc8776a09f1cfa.tar.gz |
First commit
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | PKGBUILD | 25 | ||||
-rwxr-xr-x | msmtp-flush-mail | 11 | ||||
-rw-r--r-- | msmtp.path | 7 | ||||
-rw-r--r-- | msmtp.service | 5 | ||||
-rwxr-xr-x | msmtpq-systemd | 7 |
6 files changed, 72 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..938214d8bd69 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +pkgbase = msmtpq-systemd + pkgdesc = Systemd unit for queuing and sending mail + pkgver = 1.0.0 + pkgrel = 1 + arch = any + license = GPL + depends = msmtp + source = msmtp-flush-mail + source = msmtp.path + source = msmtpq-systemd + source = msmtp.service + sha512sums = SKIP + sha512sums = SKIP + sha512sums = SKIP + sha512sums = SKIP + +pkgname = msmtpq-systemd diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..08090c0746d7 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,25 @@ +# Maintainer: Max Gautier <mg@max.gautier.name> +pkgname=msmtpq-systemd +pkgver=1.0.0 +pkgrel=1 +pkgdesc="Systemd unit for queuing and sending mail" +arch=(any) +license=('GPL') +groups=() +depends=(msmtp) +source=(msmtp-flush-mail msmtp.path msmtpq-systemd msmtp.service) +sha512sums=('SKIP' + 'SKIP' + 'SKIP' + 'SKIP') + +package() { + for i in msmtp.{path,service} + do + install -Dm644 $i $pkgdir/usr/lib/systemd/user/$i + done + for i in msmtp{-flush-mail,q-systemd} + do + install -Dm755 $i $pkgdir/usr/bin/$i + done +} diff --git a/msmtp-flush-mail b/msmtp-flush-mail new file mode 100755 index 000000000000..b365586ea2e4 --- /dev/null +++ b/msmtp-flush-mail @@ -0,0 +1,11 @@ +#!/bin/bash -e +shopt -s extglob + +MSMTP_OPT="--read-envelope-from \ + --logfile -" + +for i in $(ls -tr $1) +do + /usr/bin/msmtp ${MSMTP_OPT} ${EXTRA_OPT} $(< "$1/$i/opt") < "$1/$i/mail" + rm -r $1/$i +done diff --git a/msmtp.path b/msmtp.path new file mode 100644 index 000000000000..5335c3bb5c64 --- /dev/null +++ b/msmtp.path @@ -0,0 +1,7 @@ +[Path] +DirectoryNotEmpty=%h/.local/share/msmtp-queue +MakeDirectory=yes +DirectoryMode=0700 + +[Install] +WantedBy=paths.target diff --git a/msmtp.service b/msmtp.service new file mode 100644 index 000000000000..fce15c959ff3 --- /dev/null +++ b/msmtp.service @@ -0,0 +1,5 @@ +[Service] +Type=oneshot +ExecStart=/usr/bin/msmtp-flush-mail %h/.local/share/msmtp-queue +Restart=on-failure +RestartSec=1min diff --git a/msmtpq-systemd b/msmtpq-systemd new file mode 100755 index 000000000000..6244469ad5b8 --- /dev/null +++ b/msmtpq-systemd @@ -0,0 +1,7 @@ +#!/bin/bash -e + +tmp_dir=`mktemp -d` +echo "$@" > $tmp_dir/opt & +cp /dev/stdin $tmp_dir/mail +wait -f +mv $tmp_dir ${MAIL_QUEUE:-$HOME/.local/share/msmtp-queue}/$(uuidgen) |