27
27
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
28
28
# Portions Copyright (c) 1994, Regents of the University of California
29
29
#
30
- # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.197 2003/07/22 00:02:55 momjian Exp $
30
+ # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.198 2003/07/23 08:46:54 petere Exp $
31
31
#
32
32
# -------------------------------------------------------------------------
33
33
39
39
exit_nicely (){
40
40
sttyecho > /dev/null2>&1
41
41
echo 1>&2
42
- echo " $CMDNAME failed. " 1>&2
42
+ echo " $CMDNAME : failed" 1>&2
43
43
if [" $noclean " != yes ]; then
44
44
if [" $made_new_pgdata " = yes ]; then
45
- echo " Removing $PGDATA . " 1>&2
46
- rm -rf" $PGDATA " || echo " Failed. " 1>&2
45
+ echo " $CMDNAME : removing data directory \" $PGDATA \" " 1>&2
46
+ rm -rf" $PGDATA " || echo " $CMDNAME : failed " 1>&2
47
47
fi
48
48
else
49
- echo " Data directory$PGDATA will notbe removed at user's request. " 1>&2
49
+ echo " $CMDNAME : data directory\" $PGDATA \" not removed at user's request" 1>&2
50
50
fi
51
51
exit 1
52
52
}
@@ -135,7 +135,7 @@ elif [ -x "$bindir/postgres" ]; then
135
135
errormsg=` $bindir /postgres -V2>&1 > /dev/null`
136
136
(
137
137
echo " The program"
138
- echo " ' $bindir /postgres' "
138
+ echo " $bindir /postgres"
139
139
echo " needed by$CMDNAME does not belong to PostgreSQL version$VERSION , or"
140
140
echo " there may be a configuration problem."
141
141
if test x" $errormsg " ! = x" " ; then
@@ -147,17 +147,17 @@ elif [ -x "$bindir/postgres" ]; then
147
147
exit 1
148
148
fi
149
149
else
150
- echo " The program' postgres' is needed by$CMDNAME but was not found in" 1>&2
151
- echo " the directory' $bindir ' . Check your installation." 1>&2
150
+ echo " The program\" postgres\" is needed by$CMDNAME but was not found in" 1>&2
151
+ echo " the directory\" $bindir \" . Check your installation." 1>&2
152
152
exit 1
153
153
fi
154
154
155
155
156
156
# Now we can assume that 'pg_id' belongs to the same version as the
157
157
# verified 'postgres' in the same directory.
158
158
if [! -x " $PGPATH /pg_id" ]; then
159
- echo " The program' pg_id' is needed by$CMDNAME but was not found in" 1>&2
160
- echo " the directory' $PGPATH ' . Check your installation." 1>&2
159
+ echo " The program\" pg_id\" is needed by$CMDNAME but was not found in" 1>&2
160
+ echo " the directory\" $PGPATH \" . Check your installation." 1>&2
161
161
exit 1
162
162
fi
163
163
170
170
171
171
if [` $PGPATH /pg_id -u` -eq 0 ]
172
172
then
173
- echo " You cannot run$CMDNAME as root. Please log in (using, e.g., 'su')" 1>&2
174
- echo " as the (unprivileged) user that will own the server process." 1>&2
173
+ echo " $CMDNAME : cannot be run as root" 1>&2
174
+ echo " Please log in (using, e.g.,\" su\" ) as the (unprivileged) user that will" 1>&2
175
+ echo " own the server process." 1>&2
175
176
exit 1
176
177
fi
177
178
215
216
;;
216
217
--debug|-d)
217
218
debug=yes
218
- echo " Runningwith debug mode on ."
219
+ echo " Runningin debug mode."
219
220
;;
220
221
--show|-s)
221
222
show_setting=yes
222
223
;;
223
224
--noclean|-n)
224
225
noclean=yes
225
- echo " Runningwith noclean mode on. Mistakes will not be cleaned up."
226
+ echo " Runningin noclean mode. Mistakes will not be cleaned up."
226
227
;;
227
228
# The name of the database superuser. Can be freely changed.
228
229
--username|-U)
319
320
320
321
-* )
321
322
echo " $CMDNAME : invalid option:$1 "
322
- echo " Try' $CMDNAME --help' for more information."
323
+ echo " Try\" $CMDNAME --help\" for more information."
323
324
exit 1
324
325
;;
325
326
381
382
fi
382
383
if [-z " $ENCODINGID " ]
383
384
then
384
- echo " $CMDNAME :$ENCODING is not a validbackend encoding name" 1>&2
385
+ echo " $CMDNAME :\" $ENCODING \" is not a validserver encoding name" 1>&2
385
386
exit 1
386
387
fi
387
388
fi
394
395
if [-z " $PGDATA " ]
395
396
then
396
397
(
397
- echo " $CMDNAME : You must identify where the the data for this database"
398
- echo " system will reside. Do this with either a -D invocation"
399
- echo " option or a PGDATA environment variable."
398
+ echo " $CMDNAME : no data directory specified"
399
+ echo " You must identify the directory where the data for this database system"
400
+ echo " will reside. Do this with either the invocation option -D or the"
401
+ echo " environment variable PGDATA."
400
402
)1>&2
401
403
exit 1
402
404
fi
@@ -417,7 +419,7 @@ if [ "$show_setting" = yes ] || [ "$debug" = yes ]
417
419
then
418
420
(
419
421
echo
420
- echo " initdb variables:"
422
+ echo " $CMDNAME : internal variables:"
421
423
for var in PGDATA datadir PGPATH ENCODING ENCODINGID \
422
424
POSTGRES_SUPERUSERNAME POSTGRES_BKI \
423
425
POSTGRES_DESCR POSTGRESQL_CONF_SAMPLE \
@@ -436,9 +438,9 @@ for PREREQ_FILE in "$POSTGRES_BKI" "$POSTGRES_DESCR" \
436
438
do
437
439
if [! -f " $PREREQ_FILE " ]; then
438
440
(
439
- echo " $CMDNAME does not find the file' $PREREQ_FILE '. "
441
+ echo " $CMDNAME : file\" $PREREQ_FILE \" not found "
440
442
echo " This means you have a corrupted installation or identified the"
441
- echo " wrong directory with the-L invocation option."
443
+ echo " wrong directory with the invocation option -L ."
442
444
)1>&2
443
445
exit 1
444
446
fi
@@ -448,9 +450,8 @@ for file in "$POSTGRES_BKI"
448
450
do
449
451
if [ x" ` sed 1q$file ` " != x" # PostgreSQL$short_version " ]; then
450
452
(
451
- echo " The input file '$file ' needed by$CMDNAME does not"
452
- echo " belong to PostgreSQL$VERSION . Check your installation or specify the"
453
- echo " correct path using the -L option."
453
+ echo " $CMDNAME : input file\" $file \" does not belong to PostgreSQL$VERSION "
454
+ echo " Check your installation or specify the correct path using the option -L."
454
455
)1>&2
455
456
exit 1
456
457
fi
@@ -493,10 +494,10 @@ pgdata_contents=`ls -A "$PGDATA" 2>/dev/null`
493
494
if [ x" $pgdata_contents " != x ]
494
495
then
495
496
(
496
- echo " $CMDNAME :The directory$PGDATA exists but is not empty. "
497
+ echo " $CMDNAME : directory\" $PGDATA \" exists but is not empty"
497
498
echo " If you want to create a new database system, either remove or empty"
498
- echo " the directory$PGDATA or runinitdb with"
499
- echo " an argument other than $PGDATA ."
499
+ echo " the directory\" $PGDATA \" or run$CMDNAME with an argument other than "
500
+ echo " \" $PGDATA \" ."
500
501
)1>&2
501
502
exit 1
502
503
else
505
506
mkdir -p" $PGDATA " > /dev/null2>&1 || mkdir" $PGDATA " || exit_nicely
506
507
made_new_pgdata=yes
507
508
else
508
- $ECHO_N " Fixing permissions on existing directory$PGDATA ..." $ECHO_C
509
+ $ECHO_N " fixing permissions on existing directory$PGDATA ..." $ECHO_C
509
510
chmod go-rwx" $PGDATA " || exit_nicely
510
511
fi
511
512
echo " ok"
685
686
fi
686
687
if [! -f " $PGDATA " /global/pg_pwd ]; then
687
688
echo
688
- echo " The password file wasn't generated. Please report this problem." 1>&2
689
+ echo " $CMDNAME : The password file wasn't generated. Please report this problem." 1>&2
689
690
exit_nicely
690
691
fi
691
692
echo " ok"