Commit a08eb45c authored by Bruce Momjian's avatar Bruce Momjian

More initdb cleanup

parent 24edd34d
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.71 1999/12/18 02:48:53 momjian Exp $ # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.72 1999/12/18 02:56:01 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -65,11 +65,12 @@ then ...@@ -65,11 +65,12 @@ then
PGPATH=`echo $0 | sed 's,/[^/]*$,,'` # (dirname command is not portable) PGPATH=`echo $0 | sed 's,/[^/]*$,,'` # (dirname command is not portable)
else else
# look for it in PATH ('which' command is not portable) # look for it in PATH ('which' command is not portable)
for dir in `echo "$PATH" | sed 's/:/ /g'` ; do for dir in `echo "$PATH" | sed 's/:/ /g'`
do
# empty entry in path means current dir # empty entry in path means current dir
[ -z "$dir" ] && dir='.' [ -z "$dir" ] && dir='.'
if [ -f "$dir/$CMDNAME" ] if [ -f "$dir/$CMDNAME" ]
then then
PGPATH="$dir" PGPATH="$dir"
break break
fi fi
...@@ -77,9 +78,10 @@ else ...@@ -77,9 +78,10 @@ else
fi fi
# Check if needed programs actually exist in path # Check if needed programs actually exist in path
for prog in postgres pg_version ; do for prog in postgres pg_version
do
if [ ! -x "$PGPATH/$prog" ] if [ ! -x "$PGPATH/$prog" ]
then then
echo "The program $prog needed by $CMDNAME could not be found. It was" echo "The program $prog needed by $CMDNAME could not be found. It was"
echo "expected at:" echo "expected at:"
echo " $PGPATH/$prog" echo " $PGPATH/$prog"
...@@ -111,11 +113,6 @@ template_only=0 ...@@ -111,11 +113,6 @@ template_only=0
# user. # user.
POSTGRES_SUPERUSERNAME="$EffectiveUser" POSTGRES_SUPERUSERNAME="$EffectiveUser"
# Note: The sysid can be freely selected. This will probably confuse matters,
# but if your Unix user postgres is uid 48327 you might chose to start
# at 0 (or 1) in the database.
POSTGRES_SUPERUSERID="$EUID"
Password='_null_' Password='_null_'
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
...@@ -225,7 +222,7 @@ then ...@@ -225,7 +222,7 @@ then
if [ -n "$MULTIBYTE" ] if [ -n "$MULTIBYTE" ]
then then
echo " -e ENCODING, --pgencoding=ENCODING" echo " -e ENCODING, --pgencoding=ENCODING"
fi fi
echo " -?, --help " echo " -?, --help "
echo "" echo ""
exit 0 exit 0
...@@ -237,9 +234,9 @@ fi ...@@ -237,9 +234,9 @@ fi
if [ "$MULTIBYTE" ] if [ "$MULTIBYTE" ]
then then
MULTIBYTEID=`$PGPATH/pg_encoding $MULTIBYTE` MULTIBYTEID=`$PGPATH/pg_encoding $MULTIBYTE`
if [ "$?" -ne 0 ] if [ "$?" -ne 0 ]
then then
echo "The program pg_encoding failed. Perhaps you did not configure" echo "The program pg_encoding failed. Perhaps you did not configure"
echo "PostgreSQL for multibyte support or the program was not success-" echo "PostgreSQL for multibyte support or the program was not success-"
echo "fully installed." echo "fully installed."
...@@ -298,9 +295,10 @@ echo ...@@ -298,9 +295,10 @@ echo
if [ -z "$PGLIB" ] if [ -z "$PGLIB" ]
then then
for dir in "$PGPATH/../lib" "$PGPATH/../lib/pgsql"; do for dir in "$PGPATH/../lib" "$PGPATH/../lib/pgsql"
do
if [ -f "$dir/global1.bki.source" ] if [ -f "$dir/global1.bki.source" ]
then then
PGLIB="$dir" PGLIB="$dir"
break break
fi fi
...@@ -355,7 +353,7 @@ umask 077 ...@@ -355,7 +353,7 @@ umask 077
if [ -f "$PGDATA"/PG_VERSION ] if [ -f "$PGDATA"/PG_VERSION ]
then then
if [ "$template_only" -eq 0 ] if [ "$template_only" -eq 0 ]
then then
echo "$CMDNAME: The file $PGDATA/PG_VERSION already exists." echo "$CMDNAME: The file $PGDATA/PG_VERSION already exists."
echo "This probably means initdb has already been run and the" echo "This probably means initdb has already been run and the"
echo "database system already exists." echo "database system already exists."
...@@ -381,7 +379,7 @@ else ...@@ -381,7 +379,7 @@ else
mkdir "$PGDATA"/base || exit_nicely mkdir "$PGDATA"/base || exit_nicely
fi fi
if [ ! -d "$PGDATA"/pg_xlog ] if [ ! -d "$PGDATA"/pg_xlog ]
then then
echo "Creating database XLOG directory $PGDATA/pg_xlog" echo "Creating database XLOG directory $PGDATA/pg_xlog"
mkdir "$PGDATA"/pg_xlog || exit_nicely mkdir "$PGDATA"/pg_xlog || exit_nicely
fi fi
...@@ -448,7 +446,7 @@ then ...@@ -448,7 +446,7 @@ then
# Gotta remove that temp file before exiting on error. # Gotta remove that temp file before exiting on error.
retval="$?" retval="$?"
if [ "$noclean" -eq 0 ] if [ "$noclean" -eq 0 ]
then then
rm -f "$TEMPFILE" || exit_nicely rm -f "$TEMPFILE" || exit_nicely
fi fi
[ "$retval" -ne 0 ] && exit_nicely [ "$retval" -ne 0 ] && exit_nicely
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment