From 38b8fd29a6ce554f666db5a47517d1a5308136ca Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Thu, 12 Oct 2023 15:21:22 -0500 Subject: feat(mail): improved services and install scripts --- aerc/.config/maildir-rank-addr/config.toml | 5 ----- .../systemd/user/maildir-rank-addr@.service | 9 -------- aerc/.config/systemd/user/maildir-rank-addr@.timer | 9 -------- goimapnotify/.config/imapnotify/gmail.conf | 15 +++++++++++++ goimapnotify/.config/imapnotify/porkbun.conf | 14 ++++++++++++ goimapnotify/install.sh | 11 ++++++++++ .../.config/maildir-rank-addr/config.toml | 2 ++ .../systemd/user/maildir-rank-addr@.service | 10 +++++++++ maildir-rank-addr/install.sh | 11 ++++++++++ mbsync/.config/imapnotify/gmail.conf | 16 -------------- mbsync/.config/imapnotify/porkbun.conf | 14 ------------ mbsync/.config/systemd/user/mbsync.service | 13 ----------- mbsync/.config/systemd/user/mbsync@.service | 13 +++++++++++ mbsync/install.sh | 25 ++++++++-------------- notmuch/.config/systemd/user/notmuch.service | 11 ++++++++++ notmuch/install.sh | 10 +++++++++ nvim/install.sh | 5 +++++ r2e/install.sh | 11 ++++++++++ sheldon/install.sh | 5 +++++ 19 files changed, 127 insertions(+), 82 deletions(-) delete mode 100644 aerc/.config/maildir-rank-addr/config.toml delete mode 100644 aerc/.config/systemd/user/maildir-rank-addr@.service delete mode 100644 aerc/.config/systemd/user/maildir-rank-addr@.timer create mode 100644 goimapnotify/.config/imapnotify/gmail.conf create mode 100644 goimapnotify/.config/imapnotify/porkbun.conf create mode 100755 goimapnotify/install.sh create mode 100644 maildir-rank-addr/.config/maildir-rank-addr/config.toml create mode 100644 maildir-rank-addr/.config/systemd/user/maildir-rank-addr@.service create mode 100755 maildir-rank-addr/install.sh delete mode 100644 mbsync/.config/imapnotify/gmail.conf delete mode 100644 mbsync/.config/imapnotify/porkbun.conf delete mode 100644 mbsync/.config/systemd/user/mbsync.service create mode 100644 mbsync/.config/systemd/user/mbsync@.service create mode 100644 notmuch/.config/systemd/user/notmuch.service create mode 100755 notmuch/install.sh create mode 100755 r2e/install.sh diff --git a/aerc/.config/maildir-rank-addr/config.toml b/aerc/.config/maildir-rank-addr/config.toml deleted file mode 100644 index 139faba..0000000 --- a/aerc/.config/maildir-rank-addr/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -addresses = [ - "tobyv@tobyvin.dev", - "tobyv13@gmail.com" -] -template = "{{.Address}}\t{{.Name}}\t{{.NormalizedName}}" diff --git a/aerc/.config/systemd/user/maildir-rank-addr@.service b/aerc/.config/systemd/user/maildir-rank-addr@.service deleted file mode 100644 index 03436a3..0000000 --- a/aerc/.config/systemd/user/maildir-rank-addr@.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Generates a ranked addressbook from a maildir folder - -[Service] -Type=oneshot -ExecStart=/usr/bin/maildir-rank-addr --maildir=${XDG_DATA_HOME}/mail/%i/INBOX --outputpath=${XDG_DATA_HOME}/mail/%i/addressbook.tsv - -[Install] -WantedBy=default.target diff --git a/aerc/.config/systemd/user/maildir-rank-addr@.timer b/aerc/.config/systemd/user/maildir-rank-addr@.timer deleted file mode 100644 index d8542ab..0000000 --- a/aerc/.config/systemd/user/maildir-rank-addr@.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Addressbook generation timer - -[Timer] -OnUnitActiveSec=12h -Unit=maildir-rank-addr@%i.service - -[Install] -WantedBy=timers.target diff --git a/goimapnotify/.config/imapnotify/gmail.conf b/goimapnotify/.config/imapnotify/gmail.conf new file mode 100644 index 0000000..ae39a8c --- /dev/null +++ b/goimapnotify/.config/imapnotify/gmail.conf @@ -0,0 +1,15 @@ +{ + "host": "imap.gmail.com", + "port": 993, + "tls": true, + "tlsOptions": { + "rejectUnauthorized": false + }, + "username": "tobyv13@gmail.com", + "passwordCmd": "pass gmail | head -n1", + "onNewMail": "mbsync -c $XDG_CONFIG_HOME/mbsync/mbsyncrc gmail", + "onNewMailPost": "", + "boxes": [ + "INBOX" + ] +} diff --git a/goimapnotify/.config/imapnotify/porkbun.conf b/goimapnotify/.config/imapnotify/porkbun.conf new file mode 100644 index 0000000..60b71f9 --- /dev/null +++ b/goimapnotify/.config/imapnotify/porkbun.conf @@ -0,0 +1,14 @@ +{ + "host": "imap.porkbun.com", + "port": 993, + "tls": true, + "tlsOptions": { + "rejectUnauthorized": false + }, + "username": "tobyv@tobyvin.dev", + "passwordCmd": "pass tobyv@tobyvin.dev | head -n1", + "onNewMail": "mbsync -c $XDG_CONFIG_HOME/mbsync/mbsyncrc porkbun", + "boxes": [ + "INBOX" + ] +} diff --git a/goimapnotify/install.sh b/goimapnotify/install.sh new file mode 100755 index 0000000..312c51b --- /dev/null +++ b/goimapnotify/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if ! command -v "goimapnotify" >/dev/null; then + printf "%s: goimapnotify not found, skipping...\n" "$0" + exit 0 +fi + +printf "%s: Installing services\n" "$0" + +systemctl --user enable --now --no-block goimapnotify@gmail.service +systemctl --user enable --now --no-block goimapnotify@porkbun.service diff --git a/maildir-rank-addr/.config/maildir-rank-addr/config.toml b/maildir-rank-addr/.config/maildir-rank-addr/config.toml new file mode 100644 index 0000000..ef2b04a --- /dev/null +++ b/maildir-rank-addr/.config/maildir-rank-addr/config.toml @@ -0,0 +1,2 @@ +addresses = ["tobyv@tobyvin.dev", "tobyv13@gmail.com", "tovince@siue.edu"] +template = "{{.Address}}\t{{.Name}}\t{{.NormalizedName}}" diff --git a/maildir-rank-addr/.config/systemd/user/maildir-rank-addr@.service b/maildir-rank-addr/.config/systemd/user/maildir-rank-addr@.service new file mode 100644 index 0000000..650b77c --- /dev/null +++ b/maildir-rank-addr/.config/systemd/user/maildir-rank-addr@.service @@ -0,0 +1,10 @@ +[Unit] +Description=Generates a ranked addressbook from a maildir folder +After=mbsync@.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/maildir-rank-addr --maildir=${XDG_DATA_HOME}/mail/%i/INBOX --outputpath=${XDG_DATA_HOME}/mail/%i/addressbook.tsv + +[Install] +WantedBy=mbsync@.service diff --git a/maildir-rank-addr/install.sh b/maildir-rank-addr/install.sh new file mode 100755 index 0000000..5a449b9 --- /dev/null +++ b/maildir-rank-addr/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if ! command -v "maildir-rank-addr" >/dev/null; then + printf "%s: maildir-rank-addr not found, skipping...\n" "$0" + exit 0 +fi + +printf "%s: Installing services\n" "$0" + +systemctl --user enable --now --no-block maildir-rank-addr@gmail.service +systemctl --user enable --now --no-block maildir-rank-addr@porkbun.service diff --git a/mbsync/.config/imapnotify/gmail.conf b/mbsync/.config/imapnotify/gmail.conf deleted file mode 100644 index fc109ff..0000000 --- a/mbsync/.config/imapnotify/gmail.conf +++ /dev/null @@ -1,16 +0,0 @@ -{ - "host": "imap.gmail.com", - "port": 993, - "tls": true, - "tlsOptions": { - "rejectUnauthorized": false - }, - "username": "tobyv13@gmail.com", - "password": "", - "passwordCmd": "pass gmail | head -n1", - "onNewMail": "mbsync -c $XDG_CONFIG_HOME/mbsync/mbsyncrc gmail", - "onNewMailPost": "", - "boxes": [ - "INBOX" - ] -} diff --git a/mbsync/.config/imapnotify/porkbun.conf b/mbsync/.config/imapnotify/porkbun.conf deleted file mode 100644 index 60b71f9..0000000 --- a/mbsync/.config/imapnotify/porkbun.conf +++ /dev/null @@ -1,14 +0,0 @@ -{ - "host": "imap.porkbun.com", - "port": 993, - "tls": true, - "tlsOptions": { - "rejectUnauthorized": false - }, - "username": "tobyv@tobyvin.dev", - "passwordCmd": "pass tobyv@tobyvin.dev | head -n1", - "onNewMail": "mbsync -c $XDG_CONFIG_HOME/mbsync/mbsyncrc porkbun", - "boxes": [ - "INBOX" - ] -} diff --git a/mbsync/.config/systemd/user/mbsync.service b/mbsync/.config/systemd/user/mbsync.service deleted file mode 100644 index 514795f..0000000 --- a/mbsync/.config/systemd/user/mbsync.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Mailbox synchronization service -Documentation=man:mbsync(1) -Wants=network-online.target -Requires=gpg-agent.socket -After=network-online.target gpg-agent.socket network.target dbus.socket - -[Service] -Type=oneshot -ExecStart=/usr/bin/mbsync -Vac ${XDG_CONFIG_HOME}/mbsync/mbsyncrc - -[Install] -WantedBy=default.target diff --git a/mbsync/.config/systemd/user/mbsync@.service b/mbsync/.config/systemd/user/mbsync@.service new file mode 100644 index 0000000..4089c04 --- /dev/null +++ b/mbsync/.config/systemd/user/mbsync@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Mailbox synchronization service +Documentation=man:mbsync(1) +Wants=network-online.target +Requires=gpg-agent.socket +After=network-online.target gpg-agent.socket network.target dbus.socket + +[Service] +Type=oneshot +ExecStart=/usr/bin/mbsync -Vc ${XDG_CONFIG_HOME}/mbsync/mbsyncrc %i + +[Install] +WantedBy=default.target diff --git a/mbsync/install.sh b/mbsync/install.sh index 7433fea..de06c1a 100755 --- a/mbsync/install.sh +++ b/mbsync/install.sh @@ -1,20 +1,13 @@ #!/bin/sh -printf "%s: Installing services\n" "$0" - -if command -v mbsync >/dev/null; then - systemctl --user enable --now --no-block mbsync.service - systemctl --user enable --now --no-block maildir-notify@gmail.service - systemctl --user enable --now --no-block maildir-notify@porkbun.service -else - printf "%s: command not found: mbsync\n" "$0" - exit 1 +if ! command -v "mbsync" >/dev/null; then + printf "%s: mbsync not found, skipping...\n" "$0" + exit 0 fi -if command -v goimapnotify >/dev/null; then - systemctl --user enable --now --no-block goimapnotify@gmail.service - systemctl --user enable --now --no-block goimapnotify@porkbun.service -else - printf "%s: command not found: goimapnotify\n" "$0" - exit 1 -fi +printf "%s: Installing services\n" "$0" + +systemctl --user enable --now --no-block mbsync@gmail.service +systemctl --user enable --now --no-block mbsync@porkbun.service +systemctl --user enable --now --no-block maildir-notify@gmail.service +systemctl --user enable --now --no-block maildir-notify@porkbun.service diff --git a/notmuch/.config/systemd/user/notmuch.service b/notmuch/.config/systemd/user/notmuch.service new file mode 100644 index 0000000..fcbee89 --- /dev/null +++ b/notmuch/.config/systemd/user/notmuch.service @@ -0,0 +1,11 @@ +[Unit] +Description=Mailbox indexer service +Documentation=man:notmuch(1) +After=mbsync@.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/notmuch new + +[Install] +WantedBy=mbsync@.service diff --git a/notmuch/install.sh b/notmuch/install.sh new file mode 100755 index 0000000..12196c8 --- /dev/null +++ b/notmuch/install.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +if ! command -v "notmuch" >/dev/null; then + printf "%s: notmuch not found, skipping...\n" "$0" + exit 0 +fi + +printf "%s: Installing service\n" "$0" + +systemctl --user enable --now --no-block notmuch.service diff --git a/nvim/install.sh b/nvim/install.sh index ea885e1..8d21011 100755 --- a/nvim/install.sh +++ b/nvim/install.sh @@ -1,5 +1,10 @@ #!/bin/sh +if ! command -v "nvim" >/dev/null; then + printf "%s: nvim not found, skipping...\n" "$0" + exit 0 +fi + printf "%s: Restoring plugins\n" "$0" nvim --headless -c 'Lazy! restore' -c qa diff --git a/r2e/install.sh b/r2e/install.sh new file mode 100755 index 0000000..f4cbd0a --- /dev/null +++ b/r2e/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if ! command -v "r2e" >/dev/null; then + printf "%s: r2e not found, skipping...\n" "$0" + exit 0 +fi + +printf "%s: Installing services\n" "$0" + +systemctl --user enable --now --no-block rss2email.timer +systemctl --user start --no-block rss2email.service diff --git a/sheldon/install.sh b/sheldon/install.sh index dc431cf..06f7b5e 100755 --- a/sheldon/install.sh +++ b/sheldon/install.sh @@ -1,5 +1,10 @@ #!/bin/sh +if ! command -v "sheldon" >/dev/null; then + printf "%s: sheldon not found, skipping...\n" "$0" + exit 0 +fi + printf "%s: Installing plugins\n" "$0" sheldon -q lock -- cgit v1.2.3-70-g09d2