OSDN Git Service

Add copyright mentions, per Tom Lane.
[pg-rex/syncrep.git] / src / bin / initdb / initdb.sh
1 #! /bin/sh
2 #-------------------------------------------------------------------------
3 #
4 # initdb creates (initializes) a PostgreSQL database cluster (site,
5 # instance, installation, whatever).  A database cluster is a
6 # collection of PostgreSQL databases all managed by the same postmaster.
7 #
8 # To create the database cluster, we create the directory that contains
9 # all its data, create the files that hold the global tables, create
10 # a few other control files for it, and create two databases: the
11 # template0 and template1 databases.
12 #
13 # The template databases are ordinary PostgreSQL databases.  template0
14 # is never supposed to change after initdb, whereas template1 can be
15 # changed to add site-local standard data.  Either one can be copied
16 # to produce a new database.
17 #
18 # To create template1, we run the postgres (backend) program and
19 # feed it data from the bki files that were installed.  template0 is
20 # made just by copying the completed template1.
21 #
22 #
23 # Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
24 # Portions Copyright (c) 1994, Regents of the University of California
25 #
26 # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.121 2001/02/18 18:33:59 momjian Exp $
27 #
28 #-------------------------------------------------------------------------
29
30
31 ##########################################################################
32 #
33 # INITIALIZATION
34
35 exit_nicely(){
36     stty echo > /dev/null 2>&1
37     echo 1>&2
38     echo "$CMDNAME failed." 1>&2
39     if [ "$noclean" != yes ]; then
40         if [ "$made_new_pgdata" = yes ]; then
41             echo "Removing $PGDATA." 1>&2
42             rm -rf "$PGDATA" || echo "Failed." 1>&2
43         fi
44         echo "Removing temp file $TEMPFILE." 1>&2
45         rm -rf "$TEMPFILE" || echo "Failed." 1>&2
46     else
47         echo "Data directory $PGDATA will not be removed at user's request." 1>&2
48     fi
49     exit 1
50 }
51
52
53 CMDNAME=`basename $0`
54
55 # Placed here during build
56 VERSION='@VERSION@'
57 bindir='@bindir@'
58 # Note that "datadir" is not the directory we're initializing, it's
59 # merely how Autoconf names PREFIX/share.
60 datadir='@datadir@'
61 # as set by configure --enable-multibyte[=XXX].
62 MULTIBYTE='@MULTIBYTE@'
63
64 if [ "$TMPDIR" ]; then
65     TEMPFILE="$TMPDIR/initdb.$$"
66 else
67     TEMPFILE="/tmp/initdb.$$"
68 fi
69
70
71 # Check for echo -n vs echo \c
72 if echo '\c' | grep -s c >/dev/null 2>&1
73 then
74     ECHO_N="echo -n"
75     ECHO_C=""
76 else
77     ECHO_N="echo"
78     ECHO_C='\c'
79 fi
80
81
82 #
83 # Find out where we're located
84 #
85 if echo "$0" | grep '/' > /dev/null 2>&1 
86 then
87         # explicit dir name given
88         self_path=`echo $0 | sed 's,/[^/]*$,,'`       # (dirname command is not portable)
89 else
90         # look for it in PATH ('which' command is not portable)
91         for dir in `echo "$PATH" | sed 's/:/ /g'`
92         do
93                 # empty entry in path means current dir
94                 [ -z "$dir" ] && dir='.'
95                 if [ -f "$dir/$CMDNAME" ]
96                 then
97                         self_path="$dir"
98                         break
99                 fi
100         done
101 fi
102
103
104 # Check for right version of backend.  First we check for an
105 # executable in the same directory is this initdb script (presuming
106 # the above code worked).  Then we fall back to the hard-wired bindir.
107 # We do it in this order because during upgrades users might move
108 # their trees to backup places, so $bindir might be inaccurate.
109
110 if [ x"$self_path" != x"" ] \
111   && [ -x "$self_path/postgres" ] \
112   && [ x"`$self_path/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
113 then
114     PGPATH=$self_path
115 elif [ -x "$bindir/postgres" ]; then
116     if [ x"`$bindir/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
117     then
118         PGPATH=$bindir
119     else
120         echo "The program '$bindir/postgres' needed by $CMDNAME does not belong to" 1>&2
121         echo "PostgreSQL version $VERSION.  Check your installation." 1>&2
122         exit 1
123     fi
124 else
125     echo "The program 'postgres' is needed by $CMDNAME but was not found in" 1>&2
126     echo "the directory '$bindir'.  Check your installation." 1>&2
127     exit 1
128 fi
129
130
131 # Now we can assume that 'pg_id' belongs to the same version as the
132 # verified 'postgres' in the same directory.
133 if [ ! -x "$PGPATH/pg_id" ]; then
134     echo "The program 'pg_id' is needed by $CMDNAME but was not found in" 1>&2
135     echo "the directory '$PGPATH'.  Check your installation." 1>&2
136     exit 1
137 fi
138
139
140 EffectiveUser=`$PGPATH/pg_id -n -u`
141 if [ -z "$EffectiveUser" ]; then
142     echo "$CMDNAME: could not determine current user name" 1>&2
143     exit 1
144 fi
145
146 if [ `$PGPATH/pg_id -u` -eq 0 ]
147 then
148     echo "You cannot run $CMDNAME as root. Please log in (using, e.g., 'su')" 1>&2
149     echo "as the (unprivileged) user that will own the server process." 1>&2
150     exit 1
151 fi
152
153
154 short_version=`echo $VERSION | sed -e 's!^\([0-9][0-9]*\.[0-9][0-9]*\).*!\1!'`
155 if [ x"$short_version" = x"" ] ; then
156   echo "$CMDNAME: bug: version number has wrong format" 1>&2
157   exit 1
158 fi
159
160
161 ##########################################################################
162 #
163 # COMMAND LINE OPTIONS
164
165 # 0 is the default (non-)encoding
166 MULTIBYTEID=0
167
168 # Set defaults:
169 debug=
170 noclean=
171 show_setting=
172
173 # Note: There is a single compelling reason that the name of the database
174 #       superuser be the same as the Unix user owning the server process:
175 #       The single user postgres backend will only connect as the database
176 #       user with the same name as the Unix user running it. That's
177 #       a security measure.
178 POSTGRES_SUPERUSERNAME="$EffectiveUser"
179 POSTGRES_SUPERUSERID=`$PGPATH/pg_id -u`
180
181 while [ "$#" -gt 0 ]
182 do
183     case "$1" in
184         --help|-\?)
185                 usage=t
186                 break
187                 ;;
188         --version|-V)
189                 echo "initdb (PostgreSQL) $VERSION"
190                 exit 0
191                 ;;
192         --debug|-d)
193                 debug=yes
194                 echo "Running with debug mode on."
195                 ;;
196         --show|-s)
197                 show_setting=yes
198                 ;;        
199         --noclean|-n)
200                 noclean=yes
201                 echo "Running with noclean mode on. Mistakes will not be cleaned up."
202                 ;;
203 # The sysid of the database superuser. Can be freely changed.
204         --sysid|-i)
205                 POSTGRES_SUPERUSERID="$2"
206                 shift;;
207         --sysid=*)
208                 POSTGRES_SUPERUSERID=`echo $1 | sed 's/^--sysid=//'`
209                 ;;
210         -i*)
211                 POSTGRES_SUPERUSERID=`echo $1 | sed 's/^-i//'`
212                 ;;
213 # The default password of the database superuser.
214 # Make initdb prompt for the default password of the database superuser.
215         --pwprompt|-W)
216                 PwPrompt=1
217                 ;;
218 # Directory where to install the data. No default, unless the environment
219 # variable PGDATA is set.
220         --pgdata|-D)
221                 PGDATA="$2"
222                 shift;;
223         --pgdata=*)
224                 PGDATA=`echo $1 | sed 's/^--pgdata=//'`
225                 ;;
226         -D*)
227                 PGDATA=`echo $1 | sed 's/^-D//'`
228                 ;;
229 # The directory where the .bki input files are stored. Normally
230 # they are in PREFIX/share and this option should be unnecessary.
231         -L)
232                 datadir="$2"
233                 shift;;
234         -L*)
235                 datadir=`echo $1 | sed 's/^-L//'`
236                 ;;
237 # The encoding of the template1 database. Defaults to what you chose
238 # at configure time. (see above)
239         --encoding|-E)
240                 MULTIBYTE="$2"
241                 shift;;
242         --encoding=*)
243                 MULTIBYTE=`echo $1 | sed 's/^--encoding=//'`
244                 ;;
245         -E*)
246                 MULTIBYTE=`echo $1 | sed 's/^-E//'`
247                 ;;
248         -*)
249                 echo "$CMDNAME: invalid option: $1"
250                 echo "Try '$CMDNAME --help' for more information."
251                 exit 1
252                 ;;
253         *)
254                 PGDATA=$1
255                 ;;
256     esac
257     shift
258 done
259
260 if [ "$usage" ]; then
261     echo "$CMDNAME initializes a PostgreSQL database cluster."
262     echo
263     echo "Usage:"
264     echo "  $CMDNAME [options] datadir"
265     echo
266     echo "Options:"
267     echo " [-D, --pgdata] DATADIR       Location for this database cluster"
268     echo "  -W, --pwprompt              Prompt for a password for the new superuser"
269     if [ -n "$MULTIBYTE" ] ; then 
270         echo "  -E, --encoding ENCODING     Set the default multibyte encoding for new databases"
271     fi
272     echo "  -i, --sysid SYSID           Database sysid for the superuser"
273     echo "Less commonly used options: "
274     echo "  -L DIRECTORY                Where to find the input files"
275     echo "  -d, --debug                 Generate lots of debugging output"
276     echo "  -n, --noclean               Do not clean up after errors"
277     echo
278     echo "Report bugs to <pgsql-bugs@postgresql.org>."
279     exit 0
280 fi
281
282 #-------------------------------------------------------------------------
283 # Resolve the multibyte encoding name
284 #-------------------------------------------------------------------------
285
286 if [ "$MULTIBYTE" ]
287 then
288         MULTIBYTEID=`$PGPATH/pg_encoding $MULTIBYTE`
289         if [ "$?" -ne 0 ]
290         then
291               (
292                 echo "$CMDNAME: pg_encoding failed"
293                 echo
294                 echo "Perhaps you did not configure PostgreSQL for multibyte support or"
295                 echo "the program was not successfully installed."
296               ) 1>&2
297                 exit 1
298         fi
299         if [ -z "$MULTIBYTEID" ]
300         then
301                 echo "$CMDNAME: $MULTIBYTE is not a valid encoding name" 1>&2
302                 exit 1
303         fi
304 fi
305
306
307 #-------------------------------------------------------------------------
308 # Make sure he told us where to build the database system
309 #-------------------------------------------------------------------------
310
311 if [ -z "$PGDATA" ]
312 then
313   (
314     echo "$CMDNAME: You must identify where the the data for this database"
315     echo "system will reside.  Do this with either a -D invocation"
316     echo "option or a PGDATA environment variable."
317   ) 1>&2
318     exit 1
319 fi
320
321
322 #-------------------------------------------------------------------------
323 # Find the input files
324 #-------------------------------------------------------------------------
325
326 TEMPLATE1_BKI="$datadir"/template1.bki
327 GLOBAL_BKI="$datadir"/global.bki
328
329 TEMPLATE1_DESCR="$datadir"/template1.description
330 GLOBAL_DESCR="$datadir"/global.description
331
332 PG_HBA_SAMPLE="$datadir"/pg_hba.conf.sample
333 PG_IDENT_SAMPLE="$datadir"/pg_ident.conf.sample
334 POSTGRESQL_CONF_SAMPLE="$datadir"/postgresql.conf.sample
335
336 if [ "$show_setting" = yes ] || [ "$debug" = yes ]
337 then
338     echo
339     echo "Initdb variables:"
340     for var in PGDATA datadir PGPATH TEMPFILE MULTIBYTE MULTIBYTEID \
341         POSTGRES_SUPERUSERNAME POSTGRES_SUPERUSERID TEMPLATE1_BKI GLOBAL_BKI \
342         TEMPLATE1_DESCR GLOBAL_DESCR POSTGRESQL_CONF_SAMPLE \
343         PG_HBA_SAMPLE PG_IDENT_SAMPLE ; do
344         eval "echo '  '$var=\$$var"
345     done
346 fi
347
348 if [ "$show_setting" = yes ] ; then
349     exit 0
350 fi
351
352 for PREREQ_FILE in "$TEMPLATE1_BKI" "$GLOBAL_BKI" "$PG_HBA_SAMPLE" \
353     "$PG_IDENT_SAMPLE"
354 do
355     if [ ! -f "$PREREQ_FILE" ] ; then
356       (
357         echo "$CMDNAME does not find the file '$PREREQ_FILE'."
358         echo "This means you have a corrupted installation or identified the"
359         echo "wrong directory with the -L invocation option."
360       ) 1>&2
361         exit 1
362     fi
363 done
364
365 for file in "$TEMPLATE1_BKI" "$GLOBAL_BKI"; do
366      if [ x"`sed 1q $file`" != x"# PostgreSQL $short_version" ]; then
367        (
368          echo "The input file '$file' needed by $CMDNAME does not"
369          echo "belong to PostgreSQL $VERSION.  Check your installation or specify the"
370          echo "correct path using the -L option."
371        ) 1>&2
372          exit 1
373      fi
374 done
375
376
377 trap 'echo "Caught signal." ; exit_nicely' 1 2 3 15
378
379 # Let's go
380 echo "This database system will be initialized with username \"$POSTGRES_SUPERUSERNAME\"."
381 echo "This user will own all the data files and must also own the server process."
382 echo
383
384
385 ##########################################################################
386 #
387 # CREATE DATABASE DIRECTORY
388
389 # umask must disallow access to group, other for files and dirs
390 umask 077
391
392 # find out if directory is empty
393 pgdata_contents=`ls -A "$PGDATA" 2>/dev/null`
394 if [ x"$pgdata_contents" != x ]
395 then
396     (
397       echo "$CMDNAME: The directory $PGDATA exists but is not empty."
398       echo "If you want to create a new database system, either remove or empty"
399       echo "the directory $PGDATA or run initdb with"
400       echo "an argument other than $PGDATA."
401     ) 1>&2
402     exit 1
403 else
404     if [ ! -d "$PGDATA" ]; then
405         echo "Creating directory $PGDATA"
406         mkdir -p "$PGDATA" >/dev/null 2>&1 || mkdir "$PGDATA" || exit_nicely
407         made_new_pgdata=yes
408     else
409         echo "Fixing permissions on existing directory $PGDATA"
410         chmod go-rwx "$PGDATA" || exit_nicely
411     fi
412
413     if [ ! -d "$PGDATA"/base ]
414         then
415         echo "Creating directory $PGDATA/base"
416         mkdir "$PGDATA"/base || exit_nicely
417     fi
418     if [ ! -d "$PGDATA"/global ]
419     then
420         echo "Creating directory $PGDATA/global"
421         mkdir "$PGDATA"/global || exit_nicely
422     fi
423     if [ ! -d "$PGDATA"/pg_xlog ]
424     then
425         echo "Creating directory $PGDATA/pg_xlog"
426         mkdir "$PGDATA"/pg_xlog || exit_nicely
427     fi
428 fi
429
430
431 ##########################################################################
432 #
433 # CREATE TEMPLATE1 DATABASE
434
435 rm -rf "$PGDATA"/base/1 || exit_nicely
436 mkdir "$PGDATA"/base/1 || exit_nicely
437
438 if [ "$debug" = yes ]
439 then
440     BACKEND_TALK_ARG="-d"
441 else
442     BACKEND_TALK_ARG="-Q"
443 fi
444
445 BACKENDARGS="-boot -C -F -D$PGDATA $BACKEND_TALK_ARG"
446 FIRSTRUN="-boot -x1 -C -F -D$PGDATA $BACKEND_TALK_ARG"
447
448 echo "Creating template1 database in $PGDATA/base/1"
449 [ "$debug" = yes ] && echo "Running: $PGPATH/postgres $FIRSTRUN template1"
450
451 cat "$TEMPLATE1_BKI" \
452 | sed -e "s/PGUID/$POSTGRES_SUPERUSERID/g" \
453 | "$PGPATH"/postgres $FIRSTRUN template1 \
454 || exit_nicely
455
456 echo $short_version > "$PGDATA"/base/1/PG_VERSION || exit_nicely
457
458
459 ##########################################################################
460 #
461 # CREATE GLOBAL TABLES
462 #
463
464 echo "Creating global relations in $PGDATA/global"
465
466 [ "$debug" = yes ] && echo "Running: $PGPATH/postgres $BACKENDARGS template1"
467
468 cat "$GLOBAL_BKI" \
469 | sed -e "s/POSTGRES/$POSTGRES_SUPERUSERNAME/g" \
470       -e "s/PGUID/$POSTGRES_SUPERUSERID/g" \
471       -e "s/ENCODING/$MULTIBYTEID/g" \
472 | "$PGPATH"/postgres $BACKENDARGS template1 \
473 || exit_nicely
474
475 echo $short_version > "$PGDATA/PG_VERSION" || exit_nicely
476
477 cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf              || exit_nicely
478 cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf          || exit_nicely
479 cp "$POSTGRESQL_CONF_SAMPLE" "$PGDATA"/postgresql.conf || exit_nicely
480 chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
481         "$PGDATA"/postgresql.conf
482
483
484 ##########################################################################
485 #
486 # CREATE VIEWS and other things
487
488 echo "Initializing pg_shadow."
489
490 PGSQL_OPT="-o /dev/null -O -F -D$PGDATA"
491
492 # Create a trigger so that direct updates to pg_shadow will be written
493 # to the flat password file pg_pwd
494 echo "CREATE TRIGGER pg_sync_pg_pwd AFTER INSERT OR UPDATE OR DELETE ON pg_shadow" \
495      "FOR EACH ROW EXECUTE PROCEDURE update_pg_pwd()" \
496      | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
497
498 # needs to be done before alter user
499 echo "REVOKE ALL on pg_shadow FROM public" \
500         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
501
502 # set up password
503 if [ "$PwPrompt" ]; then
504     $ECHO_N "Enter new superuser password: "$ECHO_C
505     stty -echo > /dev/null 2>&1
506     read FirstPw
507     stty echo > /dev/null 2>&1
508     echo
509     $ECHO_N "Enter it again: "$ECHO_C
510     stty -echo > /dev/null 2>&1
511     read SecondPw
512     stty echo > /dev/null 2>&1
513     echo
514     if [ "$FirstPw" != "$SecondPw" ]; then
515         echo "Passwords didn't match." 1>&2
516         exit_nicely
517     fi
518     echo "ALTER USER \"$POSTGRES_SUPERUSERNAME\" WITH PASSWORD '$FirstPw'" \
519         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
520     if [ ! -f $PGDATA/global/pg_pwd ]; then
521         echo "The password file wasn't generated. Please report this problem." 1>&2
522         exit_nicely
523     fi
524     echo "Setting password"
525 fi
526
527
528 echo "Enabling unlimited row width for system tables."
529
530 echo "ALTER TABLE pg_attrdef CREATE TOAST TABLE" \
531         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
532 echo "ALTER TABLE pg_description CREATE TOAST TABLE" \
533         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
534 echo "ALTER TABLE pg_proc CREATE TOAST TABLE" \
535         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
536 echo "ALTER TABLE pg_relcheck CREATE TOAST TABLE" \
537         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
538 echo "ALTER TABLE pg_rewrite CREATE TOAST TABLE" \
539         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
540 echo "ALTER TABLE pg_statistic CREATE TOAST TABLE" \
541         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
542
543
544 echo "Creating system views."
545
546 echo "CREATE VIEW pg_user AS \
547         SELECT \
548             usename, \
549             usesysid, \
550             usecreatedb, \
551             usetrace, \
552             usesuper, \
553             usecatupd, \
554             '********'::text as passwd, \
555             valuntil \
556         FROM pg_shadow" \
557         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
558
559 echo "CREATE VIEW pg_rules AS \
560         SELECT \
561             C.relname AS tablename, \
562             R.rulename AS rulename, \
563             pg_get_ruledef(R.rulename) AS definition \
564         FROM pg_rewrite R, pg_class C \
565         WHERE R.rulename !~ '^_RET' \
566             AND C.oid = R.ev_class;" \
567         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
568
569 echo "CREATE VIEW pg_views AS \
570         SELECT \
571             C.relname AS viewname, \
572             pg_get_userbyid(C.relowner) AS viewowner, \
573             pg_get_viewdef(C.relname) AS definition \
574         FROM pg_class C \
575         WHERE C.relkind = 'v';" \
576         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
577
578 # XXX why does pg_tables include sequences?
579
580 echo "CREATE VIEW pg_tables AS \
581         SELECT \
582             C.relname AS tablename, \
583             pg_get_userbyid(C.relowner) AS tableowner, \
584             C.relhasindex AS hasindexes, \
585             C.relhasrules AS hasrules, \
586             (C.reltriggers > 0) AS hastriggers \
587         FROM pg_class C \
588         WHERE C.relkind IN ('r', 's');" \
589         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
590
591 echo "CREATE VIEW pg_indexes AS \
592         SELECT \
593             C.relname AS tablename, \
594             I.relname AS indexname, \
595             pg_get_indexdef(X.indexrelid) AS indexdef \
596         FROM pg_index X, pg_class C, pg_class I \
597         WHERE C.relkind = 'r' AND I.relkind = 'i' \
598             AND C.oid = X.indrelid \
599             AND I.oid = X.indexrelid;" \
600         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
601
602 echo "Loading pg_description."
603 echo "COPY pg_description FROM STDIN" > $TEMPFILE
604 cat "$TEMPLATE1_DESCR" >> $TEMPFILE
605 cat "$GLOBAL_DESCR" >> $TEMPFILE
606
607 cat $TEMPFILE \
608         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
609 rm -f "$TEMPFILE" || exit_nicely
610
611 echo "Setting lastsysoid."
612 echo "UPDATE pg_database SET \
613         datistemplate = 't', \
614         datlastsysoid = (SELECT max(oid) FROM pg_description) \
615         WHERE datname = 'template1'" \
616                 | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
617
618 echo "Vacuuming database."
619 echo "VACUUM ANALYZE" \
620         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
621
622 echo "Copying template1 to template0."
623 echo "CREATE DATABASE template0" \
624         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
625 echo "UPDATE pg_database SET \
626         datistemplate = 't', \
627         datallowconn = 'f' \
628         WHERE datname = 'template0'" \
629                 | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
630 echo "VACUUM pg_database" \
631         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
632
633
634 ##########################################################################
635 #
636 # FINISHED
637
638 echo
639 echo "Success. You can now start the database server using:"
640 echo ""
641 echo "  $PGPATH/postmaster -D $PGDATA"
642 echo "or"
643 echo "  $PGPATH/pg_ctl -D $PGDATA start"
644 echo
645
646 exit 0