#!/sbin/sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. setvar DEFAULT_FILE = ""/etc/default/sendmail"" setvar SENDMAIL = ""/usr/lib/smtp/sendmail/sendmail"" setvar PATH = ""/usr/bin:/usr/sbin:/usr/ccs/bin"" export PATH proc check_queue_interval_syntax { setvar default = ""15m"" if test $Argc -lt 1 { setvar answer = "$default" return } if echo $1 | egrep '^([0-9]*[1-9][0-9]*[smhdw])+$' >/dev/null 2>&1 { setvar answer = "$1" } else { setvar answer = "$default" } } proc check_and_kill { setvar PID = $(head -1 $1) kill -0 $PID > /dev/null 2>&1 test $Status -eq 0 && kill $PID } proc exist_or_exit { if test ! -f $1 { echo "$1 does not exist" >&2 exit $SMF_EXIT_ERR_CONFIG } } proc turn_m4_crank { # expected to be called with two arguments: .cf path & path to m4 file test $Argc -lt 2 && return setvar cf_path = "$1" setvar m4_path = "$2" if test $m4_path = "_DONT_TOUCH_THIS" { if test -f "${cf_path}.old" { mv $cf_path "${cf_path}.new" test $Status -ne 0 && exit $SMF_EXIT_ERR_CONFIG mv "${cf_path}.old" $cf_path test $Status -ne 0 && exit $SMF_EXIT_ERR_CONFIG } # # If ${cf_path}.old does not exist, assume it was taken care # of on a previous run. # } else { match $m4_path { with /* # absolute path with * return } exist_or_exit $m4_path cd $(dirname $m4_path) setvar base = $(basename $m4_path) setvar name = $(basename $m4_path .mc) setvar info = $(svcprop -p config/include_info $SMF_FMRI ) if test $info = "true" { setvar m4flags = """" } else { setvar m4flags = ""-DSUN_HIDE_INTERNAL_DETAILS"" } m4 $m4flags /etc/mail/cf/m4/cf.m4 $base > "${name}.cf" test $Status -ne 0 && exit $SMF_EXIT_ERR_CONFIG cmp -s "${name}.cf" $cf_path || shell { cp "${name}.cf" "${cf_path}.tmp" && chown root:bin "${cf_path}.tmp" && chmod 444 "${cf_path}.tmp" && mv "${cf_path}.tmp" $cf_path } test $Status -ne 0 && exit $SMF_EXIT_ERR_CONFIG } }