Project

General

Profile

Bug #2640 ยป sendmail_include.sh.patch

Jens Elkner, 2012-04-18 11:44 PM

View differences:

sendmail_include.sh Thu Apr 19 00:04:33 2012
79 79
		*)	return;;
80 80
		esac
81 81
		exist_or_exit "$m4_path"
82
		cd `dirname "$m4_path"`
83
		base=`basename "$m4_path"`
84
		name=`basename "$m4_path" .mc`
82
		if [[ $cf_path -nt $m4_path || $cf_path -ot $m4_path ]] ; then
83
			# fall through
84
			:
85
		else
86
			return
87
		fi
88
		# just in case the file tries to include files with a relative path
89
		cd `dirname "$m4_path"` || echo "Warning: Can't cd to "`dirname "$m4_path"`" (this may produce unexpected results)"
85 90
		info=`svcprop -p config/include_info $SMF_FMRI 2>/dev/null`
86 91
		if [ "$info" = "true" ]; then
87 92
			m4flags=""
88 93
		else
89 94
			m4flags="-DSUN_HIDE_INTERNAL_DETAILS"
90 95
		fi
91
		m4 $m4flags /etc/mail/cf/m4/cf.m4 "$base" > "${name}.cf"
92
		[ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
93
		cmp -s "${name}.cf" "$cf_path" || (
94
			cp "${name}.cf" "${cf_path}.tmp" &&
95
			chown root:bin "${cf_path}.tmp" &&
96
			chmod 444 "${cf_path}.tmp" &&
97
			mv "${cf_path}.tmp" "$cf_path"
96
		m4 -D_CF_DIR_=/etc/mail/cf/ $m4flags /etc/mail/cf/m4/cf.m4 "$m4_path" \
97
			> "${cf_path}.new"
98
		[[ $? -ne 0 || ! -s "${cf_path}.new" ]] && exit $SMF_EXIT_ERR_CONFIG
99
		cmp -s "${cf_path}.new" "$cf_path" || (
100
			chown root:bin "${cf_path}.new" &&
101
			chmod 444 "${cf_path}.new" &&
102
			mv "${cf_path}.new" "$cf_path"
98 103
		)
99 104
		[ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
105
		touch -r "$m4_path" "$cf_path"
100 106
	fi
101 107
}
    (1-1/1)