Skip to content

Commit

Permalink
dbschema: fix tmp file usage in makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Nov 27, 2013
1 parent 7401a7a commit 0636a00
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions db/schema/Makefile
Expand Up @@ -127,19 +127,19 @@ dbtext:
--stringparam db "dbtext" \
$(DBTEXT_XSL) opensips-"$$FILE".xml ; \
done
TMPFILE=`mktemp -t opensips-test.XXXXXXXXXX`
# small hack to create the version table entries, this is here easier as with XSL
set -e; \
TMPFILE=`mktemp -t opensips-test.XXXXXXXXXX`; \
for FILE in $(wildcard $(ROOT)/scripts/dbtext/opensips/*) ; do \
if [ -f "$$FILE" ]; then \
if [ "$$FILE" != "$(ROOT)/scripts/dbtext/opensips/version" -a \
`wc -l "$$FILE" | cut -f 1 -d ' '` -gt 1 ]; then \
tail -1 "$$FILE" >> "$(ROOT)/scripts/dbtext/opensips/version" ; \
head -n 1 "$$FILE" > $TMPFILE ; \
cp $TMPFILE "$$FILE" ; \
head -n 1 "$$FILE" > "$$TMPFILE" ; \
cp "$$TMPFILE" "$$FILE" ; \
fi ; \
fi ; \
done ; \
rm -f $TMPFILE
rm -f "$$TMPFILE"

dbtext_clean:
-@rm -f $(ROOT)/scripts/dbtext/opensips/*
Expand All @@ -153,18 +153,18 @@ db_berkeley:
--stringparam db "db_berkeley" \
$(DB_BERKELEY_XSL) opensips-"$$FILE".xml ; \
done
TMPFILE=`mktemp -t opensips-test.XXXXXXXXXX`
# small hack to create the version table entries, this is here easier as with XSL
set -e; \
TMPFILE=`mktemp -t opensips-test.XXXXXXXXXX`; \
for FILE in $(wildcard $(ROOT)/scripts/db_berkeley/opensips/*) ; do \
if [ -f "$$FILE" ]; then \
if [ "$$FILE" != "$(ROOT)/scripts/db_berkeley/opensips/version" ]; then \
tail -2 "$$FILE" >> "$(ROOT)/scripts/db_berkeley/opensips/version" ; \
head -n 10 "$$FILE" > $TMPFILE ; \
cp $TMPFILE "$$FILE" ; \
head -n 10 "$$FILE" > "$$TMPFILE" ; \
cp "$$TMPFILE" "$$FILE" ; \
fi ; \
fi ; \
done ; \
rm -f $TMPFILE
rm -f "$$TMPFILE"

db_berkeley_clean:
-@rm -f $(ROOT)/scripts/db_berkeley/opensips/*
Expand Down

0 comments on commit 0636a00

Please sign in to comment.