% cat /usr/local/courier/etc/imapd
ADDRESS=0
PORT=143
MAXDAEMONS=80
MAXPERIP=25
PIDFILE=/var/run/imapd.pid
TCPDOPTS="-nodnslookup -noidentlookup"
LOGGEROPTS="-name=imapd"
IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE"
IMAP_KEYWORDS=1
IMAP_ACL=1
IMAP_CAPABILITY_ORIG="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CR
AM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
IMAP_PROXY=0
IMAP_PROXY_FOREIGN=0
IMAP_IDLE_TIMEOUT=60
IMAP_MAILBOX_SANITY_CHECK=1
IMAP_CAPABILITY_TLS="$IMAP_CAPABILITY AUTH=PLAIN"
IMAP_CAPABILITY_TLS_ORIG="$IMAP_CAPABILITY_ORIG AUTH=PLAIN"
IMAP_DISABLETHREADSORT=0
IMAP_CHECK_ALL_FOLDERS=0
IMAP_OBSOLETE_CLIENT=0
IMAP_UMASK=022
IMAP_ULIMITD=65536
IMAP_USELOCKS=1
IMAP_SHAREDINDEXFILE=/usr/lib/courier-imap/etc/shared/index
IMAP_ENHANCEDIDLE=0
IMAP_TRASHFOLDERNAME=Trash
IMAP_EMPTYTRASH=Trash:7
IMAP_MOVE_EXPUNGE_TO_TRASH=0
SENDMAIL=/usr/sbin/sendmail
HEADERFROM=X-IMAP-Sender
IMAPDSTART=YES
MAILDIRPATH=Maildir
and you want to import it into rc
I give you
fn import_bash {
. <{ 9 sed -e 's/"//g' -e 's/=/=(''/' -e 's/(.)$/&'')/' \
-e 's/''(\$[^ ]+) /\1 ''/' -e 's/''(\$[^ ]+) ''/\1/' \
| awk ' /OPTS/ && / / { gsub(/ /, "'' ''") } { print } ' }
}
the bit inside the . <{} turns the bash into
ADDRESS=('0')
PORT=('143')
MAXDAEMONS=('80')
MAXPERIP=('25')
PIDFILE=('/var/run/imapd.pid')
TCPDOPTS=('-nodnslookup' '-noidentlookup')
LOGGEROPTS=('-name=imapd')
IMAP_CAPABILITY=('IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE')
IMAP_KEYWORDS=('1')
IMAP_ACL=('1')
IMAP_CAPABILITY_ORIG=('IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=C
RAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE')
IMAP_PROXY=('0')
IMAP_PROXY_FOREIGN=('0')
IMAP_IDLE_TIMEOUT=('60')
IMAP_MAILBOX_SANITY_CHECK=('1')
IMAP_CAPABILITY_TLS=($IMAP_CAPABILITY 'AUTH=PLAIN')
IMAP_CAPABILITY_TLS_ORIG=($IMAP_CAPABILITY_ORIG 'AUTH=PLAIN')
IMAP_DISABLETHREADSORT=('0')
IMAP_CHECK_ALL_FOLDERS=('0')
IMAP_OBSOLETE_CLIENT=('0')
IMAP_UMASK=('022')
IMAP_ULIMITD=('65536')
IMAP_USELOCKS=('1')
IMAP_SHAREDINDEXFILE=('/usr/lib/courier-imap/etc/shared/index')
IMAP_ENHANCEDIDLE=('0')
IMAP_TRASHFOLDERNAME=('Trash')
IMAP_EMPTYTRASH=('Trash:7')
IMAP_MOVE_EXPUNGE_TO_TRASH=('0')
SENDMAIL=('/usr/sbin/sendmail')
HEADERFROM=('X-IMAP-Sender')
IMAPDSTART=('YES')
MAILDIRPATH=('Maildir')
The tricky part was the OPTS, they need to be passed individually not as one string.
Sadly that means keeping an eye on when such things are needed and changing the awk guard appropriately.
No comments:
Post a Comment