also sprach Jaldhar H. Vyas <[EMAIL PROTECTED]> [2007.08.30.0732 +0200]:
> if [ ${#SSL_CERT[*]} -eq 1 -a ${#SSL_KEY[*]} -eq 1 ]; then

That's a bashism * 2: [*] as well as -a

I suggest something like this instead:

## SSL Certs
# Certs and key file
SSL_CERT="$(sed -ne 's,^[[:space:]]*ssl_cert_file[[:space:]]*=[[:space:]]*,,p')"
[ -z "$SSL_CERT" ] && SSL_CERT=/etc/ssl/certs/dovecot.pem
SSL_KEY="$(sed -ne 's,^[[:space:]]*ssl_key_file[[:space:]]*=[[:space:]]*,,p')"
[ -z "$SSL_KEY" ] && SSL_KEY=/etc/ssl/private/dovecot.pem

## Generate new certs if needed but only if exactly one key is configured
# test whether SSL_* contains a space, and only proceed if this is
# not the case
if [ "$SSL_CERT" = "${SSL_CERT#* }" ] && [ "$SSL_KEY" = "${SSL_KEY#* }" ]; then
  if [ -e $SSL_CERT ] && [ -e $SSL_KEY ]; then
    echo making certs
  else
    echo certs exist
  fi
else
  echo complex config
fi

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
"it is the customary fate of new truths
 to begin as heresies and to end as superstitions.
                                                      -- thomas huxley

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply via email to