#!/bin/bash

FILE=/etc/postfix/protected/ngs.txt
if [ ! -s "$FILE" ]; then
  NGS_PASS="Missing NGS Password in $FILE"
  echo 1>&2
  echo 1>&2
  echo 1>&2 "ERROR: $NGS_PASS"
  echo 1>&2
  echo 1>&2
else
  NGS_PASS="$(cat "$FILE")"
fi

cat <<EOF
# The passwords must be manually put in $FILE
# Then, you must run 'dpkg-reconfigure vdanjean-setup-chu-postfix'
[ge91097.chu-lyon.fr]:587 ngs-smtp-relay@ge91097.chu-lyon.fr:$NGS_PASS
[ge132116vm-david.chu-lyon.fr]:587 ngs-smtp-relay@ge132116vm-david.chu-lyon.fr:$NGS_PASS
EOF
