components/postfix/files/start-method
branchs11-update
changeset 4175 a6869c2101fe
parent 4174 8faf7a4cc4e7
equal deleted inserted replaced
4174:8faf7a4cc4e7 4175:a6869c2101fe
    25 
    25 
    26 SWITCH_FMRI=svc:/system/name-service/switch:default
    26 SWITCH_FMRI=svc:/system/name-service/switch:default
    27 
    27 
    28 tweak_aliases()
    28 tweak_aliases()
    29 {
    29 {
    30 	aliasprop=$(/usr/bin/svcprop -p config/aliases $SWITCH_FMRI 2>/dev/null)
    30 	aliasprop=$(/usr/bin/svcprop -p config/alias $SWITCH_FMRI 2>/dev/null)
    31 
    31 
    32 	# Check the alias configuration. Per
    32 	# Check the alias configuration. Per
    33 	# http://www.postfix.org/postconf.5.html
    33 	# http://www.postfix.org/postconf.5.html
    34 	#    On systems with NIS, the default is to search the local alias
    34 	#    On systems with NIS, the default is to search the local alias
    35 	#    database, then the NIS alias database. 
    35 	#    database, then the NIS alias database. 
    37 	# aliases, this will cause problems, so check and tweak the default if
    37 	# aliases, this will cause problems, so check and tweak the default if
    38 	# NIS is not configured.
    38 	# NIS is not configured.
    39 	alias_maps=$(/usr/sbin/postconf -h alias_maps)
    39 	alias_maps=$(/usr/sbin/postconf -h alias_maps)
    40 	if [[ $alias_maps == "hash:/etc/mail/aliases, nis:mail.aliases" ]]; then
    40 	if [[ $alias_maps == "hash:/etc/mail/aliases, nis:mail.aliases" ]]; then
    41 		# We have the default Postfix setting.
    41 		# We have the default Postfix setting.
    42 		if [[ "$aliasprop" == "${aliasprop%nis}" ]]; then
    42 		if [[ "$aliasprop" == "${aliasprop/nis}" ]]; then
    43 			# NIS is not configured, so change the Postfix setting.
    43 			# NIS is not configured, so change the Postfix setting.
    44 			alias_maps="hash:/etc/mail/aliases"
    44 			alias_maps="hash:/etc/mail/aliases"
    45 			/usr/sbin/postconf alias_maps=$alias_maps
    45 			/usr/sbin/postconf alias_maps=$alias_maps
    46 		fi
    46 		fi
    47 	fi
    47 	fi
    48 
    48 
    49 	# Check for LDAP: if configured via the switch, then (if needed)
    49 	# Check for LDAP: if configured via the switch, then (if needed)
    50 	# create $LDAP_ALIASES and configure in alias_maps.
    50 	# create $LDAP_ALIASES and configure in alias_maps.
    51 	LDAP_ALIASES=/etc/postfix/ldap-aliases.cf
    51 	LDAP_ALIASES=/etc/postfix/ldap-aliases.cf
    52 	if [[ $aliasprop != ${aliasprop%ldap} ]]; then
    52 	if [[ $aliasprop != ${aliasprop/ldap} ]]; then
    53 		# LDAP is configured for aliases.
    53 		# LDAP is configured for aliases.
    54 		if [[ ! -f $LDAP_ALIASES ]]; then
    54 		if [[ ! -f $LDAP_ALIASES ]]; then
    55 			# $LDAP_ALIASES does not exist yet, so create it.
    55 			# $LDAP_ALIASES does not exist yet, so create it.
    56 			servers=$(/usr/sbin/ldapclient list | \
    56 			servers=$(/usr/sbin/ldapclient list | \
    57 			    grep NS_LDAP_SERVERS | \
    57 			    grep NS_LDAP_SERVERS | \
    63 			echo "query_filter = mail=%s" >> $LDAP_ALIASES
    63 			echo "query_filter = mail=%s" >> $LDAP_ALIASES
    64 			echo "result_attribute = mgrpRFC822MailMember" >> \
    64 			echo "result_attribute = mgrpRFC822MailMember" >> \
    65 			    $LDAP_ALIASES
    65 			    $LDAP_ALIASES
    66 
    66 
    67 		fi
    67 		fi
    68 		if [[ "$alias_maps" == "${alias_maps%ldap:}" ]]; then
    68 		if [[ "$alias_maps" == "${alias_maps/ldap:}" ]]; then
    69 			# No "ldap:" entry yet in alias_maps, so add one.
    69 			# No "ldap:" entry yet in alias_maps, so add one.
    70 			/usr/sbin/postconf \
    70 			/usr/sbin/postconf \
    71 			    alias_maps="$alias_maps, ldap:$LDAP_ALIASES"
    71 			    alias_maps="$alias_maps, ldap:$LDAP_ALIASES"
    72 		fi
    72 		fi
    73 	fi
    73 	fi
       
    74 
       
    75 	# Sendmail in Solaris 11 is linked with an old Berkeley DB version.
       
    76 	/usr/bin/db_upgrade /etc/mail/aliases.db
    74 }
    77 }
    75 
    78 
    76 # First, make sure we have a valid domain name.
    79 # First, make sure we have a valid domain name.
    77 myhostname=$(/usr/bin/hostname)
    80 myhostname=$(/usr/bin/hostname)
    78 case $myhostname in
    81 case $myhostname in