build system: fix for dash

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2010-11-24 15:06:49 +01:00
parent 7386dd1e8a
commit 749e305d36

View File

@ -18,14 +18,17 @@ generate()
local src="$1" dst="$2" header="$3" insert="$4" local src="$1" dst="$2" header="$3" insert="$4"
#chk "${dst}" #chk "${dst}"
( (
echo "${header}" # need to use printf: different shells have inconsistent
# rules re handling of "\n" in their params,
# and ${insert} definitely contains "\n"
printf "%s\n" "${header}"
if grep -qs '^INSERT$' "${src}"; then if grep -qs '^INSERT$' "${src}"; then
sed -n '1,/^INSERT$/p' "${src}" sed -n '1,/^INSERT$/p' "${src}"
echo "${insert}" printf "%s\n" "${insert}"
sed -n '/^INSERT$/,$p' "${src}" sed -n '/^INSERT$/,$p' "${src}"
else else
if [ -n "${insert}" ]; then if [ -n "${insert}" ]; then
echo "ERROR: INSERT line missing in: ${src}" 1>&2 printf "%s\n" "ERROR: INSERT line missing in: ${src}" 1>&2
fi fi
cat "${src}" cat "${src}"
fi fi