#!/bin/sh shout() { echo "${0}: $@" >&2; } barf() { shout "fatal: $@"; exit 111; } safe() { "$@" || barf "cannot $@"; } safe umask 022 here=`env - PATH=$PATH pwd` mypwd=${here%package} mypwd=${mypwd%/} home=`head -1 $mypwd/conf-home` nofiles=`grep auxiliar $mypwd/conf-ids | awk -F: '{print $2}'` sqmtls=`grep TLS $mypwd/conf-ids | awk -F: '{print $2}'` safe mkdir -p $home/ssl safe chown $sqmtls:$nofiles $home/ssl ucspi=`head -1 $mypwd/conf-ucspissl` if [ -d $ucspi/etc ] then for i in `ls $ucspi/etc` do shout "Copying ucspi-ssl file '$i' to $home/ssl" safe cp "$ucspi/etc/$i" "$home/ssl/$i" safe chown $sqmtls:$nofiles "$home/ssl/$i" done else barf "Can't find ucspi-ssl dir. Check 'conf-ucspissl'." fi [ -f $mypwd/service/ssl.env ] && \ safe cat $mypwd/service/ssl.env \ | eval sed -e 's}QMAIL}$home}g' \ -e 's}SQMTLS}$sqmtls}g' \ -e 's}NOFILES}$nofiles}g' \ > $home/ssl/ssl.env shout "Environment for s/qmail TLS defined in $home/ssl/ssl.env" exit 0