From 0f6176cab449b83b176d0bf5d0537a767a183915 Mon Sep 17 00:00:00 2001 From: Jeff LANCE Date: Sun, 3 Mar 2024 22:59:30 +0100 Subject: [PATCH] Up. --- ...{.chezmoi.toml.tmpl => .chezmoi.yaml.tmpl} | 10 +- home/dot_mbsyncrc.tmpl | 282 +++--------------- 2 files changed, 45 insertions(+), 247 deletions(-) rename home/{.chezmoi.toml.tmpl => .chezmoi.yaml.tmpl} (54%) diff --git a/home/.chezmoi.toml.tmpl b/home/.chezmoi.yaml.tmpl similarity index 54% rename from home/.chezmoi.toml.tmpl rename to home/.chezmoi.yaml.tmpl index 4f2e6d6..9f9cb70 100644 --- a/home/.chezmoi.toml.tmpl +++ b/home/.chezmoi.yaml.tmpl @@ -1,6 +1,10 @@ {{- $email := promptStringOnce . "email" "Email address" -}} {{- $mbsyncAccounts := promptIntOnce . "mbsyncAccounts" "Nombre de comptes email" -}} -[data] - email = {{ $email | quote }} - mbsyncAccounts = {{ $mbsyncAccounts }} +data + email: {{ $email | quote }} + +mbsync: + - name: "account name" + email: "account mail" + server: "account server" diff --git a/home/dot_mbsyncrc.tmpl b/home/dot_mbsyncrc.tmpl index 759a455..0692215 100644 --- a/home/dot_mbsyncrc.tmpl +++ b/home/dot_mbsyncrc.tmpl @@ -24,17 +24,19 @@ BufferLimit 100M # # ########################## -# jeff.lance@mala.fr +{{ range $value := .mbsync }} + +# {{ $value.name }} #------------------------- -IMAPAccount jeff.lance@mala.fr +IMAPAccount {{ $value.name }} # Address to connect to -Host ssl0.ovh.net -User jeff.lance@mala.fr +Host {{- $value.server -}} +User {{- $value.username -}} # Get the password account through secret-tool # I replaced it by a pass command # PassCmd "secret-tool lookup email jeff.lance@mala.fr service imap" -PassCmd "pass ssl0.ovh.net/jeff.lance@mala.fr" +PassCmd "pass {{- $value.server -}}/{{- $value.username -}}" # Use SSL # SSLType IMAPS SSLType None @@ -44,61 +46,61 @@ SSLType None CertificateFile /etc/ssl/certs/ca-certificates.crt -IMAPStore jeff.lance@mala.fr-remote -Account jeff.lance@mala.fr +IMAPStore {{- $value.name -}}-remote +Account {{- $value.name -}} -MaildirStore jeff.lance@mala.fr-local +MaildirStore {{- $value.name -}}-local SubFolders Verbatim # The trailing "/" is important -Path ~/Mail/jeff.lance@mala.fr/ -Inbox ~/Mail/jeff.lance@mala.fr/inbox +Path ~/Mail/{{- $value.name -}}/ +Inbox ~/Mail/{{- $value.name -}}/inbox -Channel jeff.lance@mala.fr-inbox -Far :jeff.lance@mala.fr-remote: -Near :jeff.lance@mala.fr-local:inbox +Channel {{- $value.name -}}-inbox +Far :{{- $value.name -}}-remote: +Near :{{- $value.name -}}-local:inbox Sync PullNew PullDelete Push SyncState * # Remove Both Expunge Both -Channel jeff.lance@mala.fr-sent -Far :jeff.lance@mala.fr-remote:"Sent Items" -Near :jeff.lance@mala.fr-local:sent +Channel {{- $value.name -}}-sent +Far :{{- $value.name -}}-remote:"Sent Items" +Near :{{- $value.name -}}-local:sent Sync PullNew PullDelete Push SyncState * Expunge Both -Channel jeff.lance@mala.fr-trash -Far :jeff.lance@mala.fr-remote:"Deleted Items" -Near :jeff.lance@mala.fr-local:trash +Channel {{- $value.name -}}-trash +Far :{{- $value.name -}}-remote:"Deleted Items" +Near :{{- $value.name -}}-local:trash Sync PullNew PullDelete Push SyncState * Expunge Both -Channel jeff.lance@mala.fr-drafts -Far :jeff.lance@mala.fr-remote:"Drafts" -Near :jeff.lance@mala.fr-local:drafts +Channel {{- $value.name -}}-drafts +Far :{{- $value.name -}}-remote:"Drafts" +Near :{{- $value.name -}}-local:drafts Sync PullNew PullDelete Push SyncState * Expunge Both -Channel jeff.lance@mala.fr-junk -Far :jeff.lance@mala.fr-remote:"Junk Email" -Near :jeff.lance@mala.fr-local:junk +Channel {{- $value.name -}}-junk +Far :{{- $value.name -}}-remote:"Junk Email" +Near :{{- $value.name -}}-local:junk Sync PullNew PullDelete Push SyncState * Expunge Both -Channel jeff.lance@mala.fr-archive -Far :jeff.lance@mala.fr-remote:"Archive" -Near :jeff.lance@mala.fr-local:archive +Channel {{- $value.name -}}-archive +Far :{{- $value.name -}}-remote:"Archive" +Near :{{- $value.name -}}-local:archive Pattern * Create Near MaxMessages 1500 @@ -107,220 +109,12 @@ SyncState * Expunge Both -Group jeff.lance@mala.fr -Channel jeff.lance@mala.fr-inbox -Channel jeff.lance@mala.fr-sent -Channel jeff.lance@mala.fr-trash -Channel jeff.lance@mala.fr-drafts -Channel jeff.lance@mala.fr-junk -Channel jeff.lance@mala.fr-archive - - - -# games@mala.fr -#------------------------- - -IMAPAccount games@mala.fr -# Address to connect to -Host ssl0.ovh.net -User games@mala.fr -# Get the password account through secret-tool -# I replaced it by a pass command -# PassCmd "secret-tool lookup email games@mala.fr service imap" -PassCmd "pass ssl0.ovh.net/games@mala.fr" -# Use SSL -# SSLType IMAPS -SSLType None -# The following line should work. -# If get certificate errors, uncomment the two -# following lines and read the "Troubleshooting" section. -CertificateFile /etc/ssl/certs/ca-certificates.crt - - -IMAPStore games@mala.fr-remote -Account games@mala.fr - - -MaildirStore games@mala.fr-local -SubFolders Verbatim -# The trailing "/" is important -Path ~/Mail/games@mala.fr/ -Inbox ~/Mail/games@mala.fr/inbox - - -Channel games@mala.fr-inbox -Far :games@mala.fr-remote: -Near :games@mala.fr-local:inbox -Sync PullNew PullDelete Push -SyncState * -Expunge Both - - -Channel games@mala.fr-sent -Far :games@mala.fr-remote:"Sent Items" -Near :games@mala.fr-local:sent -Sync PullNew PullDelete Push -SyncState * -Expunge Both - - -Channel games@mala.fr-trash -Far :games@mala.fr-remote:"Deleted Items" -Near :games@mala.fr-local:trash -Sync PullNew PullDelete Push -SyncState * -Expunge Both - - -Channel games@mala.fr-drafts -Far :games@mala.fr-remote:"Drafts" -Near :games@mala.fr-local:drafts -Sync PullNew PullDelete Push -SyncState * -Expunge Both - - -Channel games@mala.fr-junk -Far :games@mala.fr-remote:"Junk Email" -Near :games@mala.fr-local:junk -Sync PullNew PullDelete Push -SyncState * -Expunge Both - - -Group games@mala.fr -Channel games@mala.fr-inbox -Channel games@mala.fr-sent -Channel games@mala.fr-trash -Channel games@mala.fr-drafts -Channel games@mala.fr-junk - - -# jean-francois.lance@ac-creteil.fr -#-------------------------------------- - -IMAPAccount jean-francois.lance@ac-creteil.fr -# Address to connect to -Host imap.ac-creteil.fr -User jlance -# Get the password account through secret-tool -# I replaced it by a pass command -# PassCmd "secret-tool lookup email jean-francois.lance@ac-creteil.fr service imap" -PassCmd "pass ac-creteil.fr/jlance" -# Use SSL -SSLType IMAPS -# The following line should work. -# If get certificate errors, uncomment the two -# following lines and read the "Troubleshooting" section. -CertificateFile /etc/ssl/certs/ca-certificates.crt - -IMAPStore jean-francois.lance@ac-creteil.fr-remote -Account jean-francois.lance@ac-creteil.fr - -MaildirStore jean-francois.lance@ac-creteil.fr-local -SubFolders Verbatim -# The trailing "/" is important -Path ~/Mail/jean-francois.lance@ac-creteil.fr/ -Inbox ~/Mail/jean-francois.lance@ac-creteil.fr/inbox - -Channel jean-francois.lance@ac-creteil.fr-inbox -Far :jean-francois.lance@ac-creteil.fr-remote: -Near :jean-francois.lance@ac-creteil.fr-local: -Patterns "INBOX" -Sync PullNew PullDelete Push -SyncState * -Expunge Both - -Channel jean-francois.lance@ac-creteil.fr-sent -Far :jean-francois.lance@ac-creteil.fr-remote:"Sent" -Near :jean-francois.lance@ac-creteil.fr-local:sent -Sync PullNew PullDelete Push -SyncState * -Expunge Both - -Channel jean-francois.lance@ac-creteil.fr-trash -Far :jean-francois.lance@ac-creteil.fr-remote:"Trash" -Near :jean-francois.lance@ac-creteil.fr-local:trash -Sync PullNew PullDelete Push -SyncState * -Expunge Both - -Channel jean-francois.lance@ac-creteil.fr-drafts -Far :jean-francois.lance@ac-creteil.fr-remote:"Drafts" -Near :jean-francois.lance@ac-creteil.fr-local:drafts -Sync PullNew PullDelete Push -SyncState * -Expunge Both - -Group jean-francois.lance@ac-creteil.fr -Channel jean-francois.lance@ac-creteil.fr-inbox -Channel jean-francois.lance@ac-creteil.fr-sent -Channel jean-francois.lance@ac-creteil.fr-trash -Channel jean-francois.lance@ac-creteil.fr-drafts - - - -## jean-francois.lance@ac-montpellier.fr -##-------------------------------------- - -#IMAPAccount jean-francois.lance@ac-montpellier.fr -## Address to connect to -#Host courrier.ac-montpellier.fr -#User jlance -#PassCmd "secret-tool lookup email jean-francois.lance@ac-montpellier.fr" -## Use SSL -#SSLType IMAPS -## The following line should work. -## If get certificate errors, uncomment the two -## following lines and read the "Troubleshooting" section. -#CertificateFile /etc/ssl/certs/ca-certificates.crt - -#IMAPStore jean-francois.lance@ac-montpellier.fr-remote -#Account jean-francois.lance@ac-montpellier.fr - -#MaildirStore jean-francois.lance@ac-montpellier.fr-local -#SubFolders Verbatim -## The trailing "/" is important -#Path ~/Mail/jean-francois.lance@ac-montpellier.fr/ -#Inbox ~/Mail/jean-francois.lance@ac-montpellier.fr/INBOX - -#Channel jean-francois.lance@ac-montpellier.fr-inbox -#Far :jean-francois.lance@ac-montpellier.fr-remote: -#Near :jean-francois.lance@ac-montpellier.fr-local: -#Patterns "INBOX" -#Expunge Both - -#Channel jean-francois.lance@ac-montpellier.fr-sent -#Far :jean-francois.lance@ac-montpellier.fr-remote:"Sent" -#Near :jean-francois.lance@ac-montpellier.fr-local:SENT -#Expunge Both - -#Channel jean-francois.lance@ac-montpellier.fr-trash -#Far :jean-francois.lance@ac-montpellier.fr-remote:"Trash" -#Near :jean-francois.lance@ac-montpellier.fr-local:TRASH -#Expunge Both - -#Channel jean-francois.lance@ac-montpellier.fr-drafts -#Far :jean-francois.lance@ac-montpellier.fr-remote:"Drafts" -#Near :jean-francois.lance@ac-montpellier.fr-local:DRAFTS -#Expunge Both - -#Channel jean-francois.lance@ac-montpellier.fr-spams -#Far :jean-francois.lance@ac-montpellier.fr-remote:"Spams" -#Near :jean-francois.lance@ac-montpellier.fr-local:SPAMS -#Expunge Both - -#Channel jean-francois.lance@ac-montpellier.fr-archives -#Far :jean-francois.lance@ac-montpellier.fr-remote:"Archives" -#Near :jean-francois.lance@ac-montpellier.fr-local:ARCHIVES -#Patterns * - -#Group jean-francois.lance@ac-montpellier.fr -#Channel jean-francois.lance@ac-montpellier.fr-inbox -#Channel jean-francois.lance@ac-montpellier.fr-sent -#Channel jean-francois.lance@ac-montpellier.fr-trash -#Channel jean-francois.lance@ac-montpellier.fr-drafts -#Channel jean-francois.lance@ac-montpellier.fr-spams -#Channel jean-francois.lance@ac-montpellier.fr-archives - +Group {{- $value.name -}} +Channel {{- $value.name -}}-inbox +Channel {{- $value.name -}}-sent +Channel {{- $value.name -}}-trash +Channel {{- $value.name -}}-drafts +Channel {{- $value.name -}}-junk +Channel {{- $value.name -}}-archive +{{ end }}