|
26 | 26 | #
|
27 | 27 | #
|
28 | 28 | # IDENTIFICATION
|
29 |
| -# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.77 1999/12/22 04:23:31 ishii Exp $ |
| 29 | +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.78 2000/01/13 18:22:10 petere Exp $ |
30 | 30 | #
|
31 | 31 | #-------------------------------------------------------------------------
|
32 | 32 |
|
33 | 33 | exit_nicely(){
|
34 | 34 | echo
|
35 | 35 | echo"$CMDNAME failed."
|
36 |
| -if ["$noclean"-eq 0 ] |
37 |
| -then |
| 36 | +if ["$noclean"-eq 0 ];then |
38 | 37 | echo"Removing$PGDATA."
|
39 | 38 | rm -rf"$PGDATA"||echo"Failed."
|
| 39 | +echo"Removing temp file$TEMPFILE." |
| 40 | + rm -rf"$TEMPFILE"||echo"Failed." |
40 | 41 | else
|
41 | 42 | echo"Data directory$PGDATA will not be removed at user's request."
|
42 | 43 | fi
|
|
53 | 54 | fi
|
54 | 55 |
|
55 | 56 | EffectiveUser=`id -n -u2>/dev/null|| whoami2>/dev/null`
|
56 |
| -TEMPFILE="/tmp/initdb.$$" |
| 57 | +if ["$TMPDIR" ];then |
| 58 | + TEMPFILE="$TMPDIR/initdb.$$" |
| 59 | +else |
| 60 | + TEMPFILE="/tmp/initdb.$$" |
| 61 | +fi |
57 | 62 |
|
58 | 63 | #
|
59 | 64 | # Find out where we're located
|
@@ -547,10 +552,17 @@ echo "CREATE VIEW pg_indexes AS \
|
547 | 552 | |"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
|
548 | 553 |
|
549 | 554 | echo"Loading pg_description."
|
550 |
| -echo"COPY pg_description FROM '$TEMPLATE_DESCR'" \ |
551 |
| -|"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely |
552 |
| -echo"COPY pg_description FROM '$GLOBAL_DESCR'" \ |
| 555 | +echo"COPY pg_description FROM STDIN">$TEMPFILE |
| 556 | +cat"$TEMPLATE_DESCR">>$TEMPFILE |
| 557 | +cat"$GLOBAL_DESCR">>$TEMPFILE |
| 558 | + |
| 559 | +cat$TEMPFILE \ |
553 | 560 | |"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
|
| 561 | +if ["$noclean"-eq 0 ] |
| 562 | +then |
| 563 | + rm -f"$TEMPFILE"|| exit_nicely |
| 564 | +fi |
| 565 | + |
554 | 566 | echo"Vacuuming database."
|
555 | 567 | echo"VACUUM ANALYZE" \
|
556 | 568 | |"$PGPATH"/postgres$PGSQL_OPT template1> /dev/null|| exit_nicely
|
|