mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Remove most compile-time options, add a few runtime options to make up for it.
In particular, no more compiled-in default for PGDATA or LIBDIR. Commands that need them need either invocation options or environment variables. PGPORT default is hardcoded as 5432, but overrideable with options or environment variables.
This commit is contained in:
parent
7ac541daf1
commit
f64b840387
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
||||
# Makefile for libpq subsystem (backend half of libpq interface)
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.3 1996/11/06 08:48:21 scrappy Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.4 1996/11/14 10:23:51 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -16,7 +16,6 @@ INCLUDE_OPT = -I.. \
|
||||
-I../../include
|
||||
|
||||
CFLAGS+=$(INCLUDE_OPT)
|
||||
CFLAGS+= -DPOSTPORT='"$(POSTPORT)"'
|
||||
|
||||
# kerberos flags
|
||||
ifdef KRBVERS
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.6 1996/11/08 05:56:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.7 1996/11/14 10:23:53 bryanh Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -140,7 +140,7 @@ pq_getport()
|
||||
|
||||
if (envport)
|
||||
return(atoi(envport));
|
||||
return(atoi(POSTPORT));
|
||||
return(atoi(DEF_PGPORT));
|
||||
}
|
||||
|
||||
/* --------------------------------
|
||||
|
@ -30,7 +30,6 @@ struct sembuf
|
||||
|
||||
#define MAXHOSTNAMELEN 12 /* where is the official definition of this? */
|
||||
#define MAXPATHLEN _MAX_PATH /* in winsock.h */
|
||||
#define POSTPORT "5432"
|
||||
|
||||
/* NT has stricmp not strcasecmp. Which is ANSI? */
|
||||
#define strcasecmp(a,b) _stricmp(a,b)
|
||||
@ -46,5 +45,3 @@ struct sembuf
|
||||
#define GETNCNT 5
|
||||
#define GETVAL 6
|
||||
|
||||
#define POSTGRESDIR "d:\\pglite"
|
||||
#define PGDATADIR "d:\\pglite\\data"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.10 1996/11/10 03:03:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.11 1996/11/14 10:24:22 bryanh Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -234,7 +234,7 @@ DebugFileOpen(void)
|
||||
fd = fileno(stderr);
|
||||
if (fcntl(fd, F_GETFD, 0) < 0) {
|
||||
sprintf(OutputFileName, "%s/pg.errors.%d",
|
||||
GetPGData(), (int)getpid());
|
||||
DataDir, (int)getpid());
|
||||
fd = open(OutputFileName, O_CREAT|O_APPEND|O_WRONLY, 0666);
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Makefile for utils/init
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.3 1996/11/12 06:46:40 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.4 1996/11/14 10:24:32 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -16,9 +16,6 @@ INCLUDE_OPT = -I../.. \
|
||||
-I../../../include
|
||||
|
||||
CFLAGS += $(INCLUDE_OPT)
|
||||
# The following defines really ought to go in config.h
|
||||
CFLAGS += -DPOSTGRESDIR='"$(POSTGRESDIR)"' -DPGDATADIR='"$(DATADIR)"' \
|
||||
-DPOSTPORT='"$(POSTPORT)"'
|
||||
|
||||
OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.2 1996/11/06 10:31:54 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.3 1996/11/14 10:24:38 bryanh Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Globals used all over the place should be declared here and not
|
||||
@ -99,12 +99,3 @@ char *SharedSystemRelationNames[] = {
|
||||
VariableRelationName,
|
||||
0
|
||||
};
|
||||
|
||||
/* set up global variables, pointers, etc. */
|
||||
void InitGlobals()
|
||||
{
|
||||
MasterPid = getpid();
|
||||
DataDir = GetPGData();
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.2 1996/11/06 10:31:57 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.3 1996/11/14 10:24:41 bryanh Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -345,35 +345,3 @@ SetUserId()
|
||||
UserRelationName);
|
||||
UserId = (Oid) ((Form_pg_user) GETSTRUCT(userTup))->usesysid;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* GetPGHome
|
||||
*
|
||||
* Get POSTGRESHOME from environment, or return default.
|
||||
* ----------------
|
||||
*/
|
||||
char *
|
||||
GetPGHome()
|
||||
{
|
||||
#ifdef USE_ENVIRONMENT
|
||||
char *h;
|
||||
|
||||
if ((h = getenv("POSTGRESHOME")) != (char *) NULL)
|
||||
return (h);
|
||||
#endif /* USE_ENVIRONMENT */
|
||||
return (POSTGRESDIR);
|
||||
|
||||
}
|
||||
|
||||
char *
|
||||
GetPGData()
|
||||
{
|
||||
#ifdef USE_ENVIRONMENT
|
||||
char *p;
|
||||
|
||||
if ((p = getenv("PGDATA")) != (char *) NULL) {
|
||||
return (p);
|
||||
}
|
||||
#endif /* USE_ENVIRONMENT */
|
||||
return (PGDATADIR);
|
||||
}
|
||||
|
@ -7,21 +7,17 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.2 1996/11/11 13:39:34 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.3 1996/11/14 10:24:45 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
SRCDIR= ../..
|
||||
include ../../Makefile.global
|
||||
|
||||
SEDSCRIPT= \
|
||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
|
||||
|
||||
all: createdb
|
||||
|
||||
createdb:
|
||||
sed $(SEDSCRIPT) <createdb.sh >createdb
|
||||
createdb: createdb.sh
|
||||
cp createdb.sh createdb
|
||||
|
||||
install: createdb
|
||||
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
|
||||
|
@ -11,23 +11,10 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.4 1996/09/21 06:24:07 scrappy Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.5 1996/11/14 10:24:46 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# ----------------
|
||||
# Set paths from environment or default values.
|
||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
||||
# from the default value for this build.
|
||||
# Currently the only thing we look for from the environment is
|
||||
# PGDATA, PGHOST, and PGPORT
|
||||
#
|
||||
# ----------------
|
||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
||||
PATH=$BINDIR:$PATH
|
||||
|
||||
CMDNAME=`basename $0`
|
||||
|
||||
if [ -z "$USER" ]; then
|
||||
@ -55,12 +42,29 @@ do
|
||||
shift;
|
||||
done
|
||||
|
||||
AUTHOPT="-a $AUTHSYS"
|
||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
||||
if [-z "$AUTHSYS" ]; then
|
||||
AUTHOPT = ""
|
||||
else
|
||||
AUTHOPT = "-a $AUTHSYS"
|
||||
fi
|
||||
|
||||
psql -tq $AUTHOPT -h $PGHOST -p $PGPORT -c "create database $dbname" template1 || {
|
||||
if [-z "$PGHOST" ]; then
|
||||
PGHOSTOPT = ""
|
||||
else
|
||||
PGHOSTOPT = "-h $PGHOST"
|
||||
fi
|
||||
|
||||
if [-z "$PGPORT" ]; then
|
||||
PGPORTOPT = ""
|
||||
else
|
||||
PGPORTOPT = "-p $PGPORT"
|
||||
fi
|
||||
|
||||
psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "create database $dbname" template1
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
echo "$CMDNAME: database creation failed on $dbname."
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.2 1996/11/11 13:39:40 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.3 1996/11/14 10:24:48 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -15,14 +15,12 @@ SRCDIR= ../..
|
||||
include ../../Makefile.global
|
||||
|
||||
SEDSCRIPT= \
|
||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" \
|
||||
-e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
|
||||
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
|
||||
|
||||
all: createuser
|
||||
|
||||
createuser:
|
||||
createuser: createuser.sh
|
||||
sed $(SEDSCRIPT) <createuser.sh >createuser
|
||||
|
||||
install: createuser
|
||||
|
@ -8,25 +8,12 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.5 1996/10/04 20:29:35 scrappy Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.6 1996/11/14 10:24:54 bryanh Exp $
|
||||
#
|
||||
# Note - this should NOT be setuid.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# ----------------
|
||||
# Set paths from environment or default values.
|
||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
||||
# from the default value for this build.
|
||||
# Currently the only thing we look for from the environment is
|
||||
# PGDATA, PGHOST, and PGPORT
|
||||
#
|
||||
# ----------------
|
||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
||||
PATH=$BINDIR:$PATH
|
||||
|
||||
CMDNAME=`basename $0`
|
||||
|
||||
if [ -z "$USER" ]; then
|
||||
@ -52,10 +39,25 @@ do
|
||||
shift;
|
||||
done
|
||||
|
||||
AUTHOPT="-a $AUTHSYS"
|
||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
||||
if [-z "$AUTHSYS" ]; then
|
||||
AUTHOPT = ""
|
||||
else
|
||||
AUTHOPT = "-a $AUTHSYS"
|
||||
fi
|
||||
|
||||
PARGS="-tq $AUTHOPT -h $PGHOST -p $PGPORT"
|
||||
if [-z "$PGHOST" ]; then
|
||||
PGHOSTOPT = ""
|
||||
else
|
||||
PGHOSTOPT = "-h $PGHOST"
|
||||
fi
|
||||
|
||||
if [-z "$PGPORT" ]; then
|
||||
PGPORTOPT = ""
|
||||
else
|
||||
PGPORTOPT = "-p $PGPORT"
|
||||
fi
|
||||
|
||||
PARGS="-tq $AUTHOPT $PGHOSTOPT $PGPORTOPT
|
||||
|
||||
#
|
||||
# generate the first part of the actual monitor command
|
||||
|
@ -7,21 +7,17 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.2 1996/11/11 13:39:47 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.3 1996/11/14 10:25:10 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
SRCDIR= ../..
|
||||
include ../../Makefile.global
|
||||
|
||||
SEDSCRIPT= \
|
||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
|
||||
|
||||
all: destroydb
|
||||
|
||||
destroydb:
|
||||
sed $(SEDSCRIPT) <destroydb.sh >destroydb
|
||||
destroydb: destroydb.sh
|
||||
cp destroydb.sh destroydb
|
||||
|
||||
install: destroydb
|
||||
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
|
||||
|
@ -11,23 +11,10 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.4 1996/09/21 06:24:24 scrappy Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.5 1996/11/14 10:25:14 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# ----------------
|
||||
# Set paths from environment or default values.
|
||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
||||
# from the default value for this build.
|
||||
# Currently the only thing we look for from the environment is
|
||||
# PGDATA, PGHOST, and PGPORT
|
||||
#
|
||||
# ----------------
|
||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
||||
PATH=$BINDIR:$PATH
|
||||
|
||||
CMDNAME=`basename $0`
|
||||
|
||||
if [ -z "$USER" ]; then
|
||||
@ -55,10 +42,25 @@ do
|
||||
shift;
|
||||
done
|
||||
|
||||
AUTHOPT="-a $AUTHSYS"
|
||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
||||
if [-z "$AUTHSYS" ]; then
|
||||
AUTHOPT = ""
|
||||
else
|
||||
AUTHOPT = "-a $AUTHSYS"
|
||||
fi
|
||||
|
||||
psql -tq -h $PGHOST -p $PGPORT -c "drop database $dbname" template1
|
||||
if [-z "$PGHOST" ]; then
|
||||
PGHOSTOPT = ""
|
||||
else
|
||||
PGHOSTOPT = "-h $PGHOST"
|
||||
fi
|
||||
|
||||
if [-z "$PGPORT" ]; then
|
||||
PGPORTOPT = ""
|
||||
else
|
||||
PGPORTOPT = "-p $PGPORT"
|
||||
fi
|
||||
|
||||
psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "drop database $dbname" template1
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/Makefile,v 1.2 1996/11/11 13:40:04 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/Makefile,v 1.3 1996/11/14 10:25:16 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -15,14 +15,12 @@ SRCDIR= ../..
|
||||
include ../../Makefile.global
|
||||
|
||||
SEDSCRIPT= \
|
||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" \
|
||||
-e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
|
||||
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
|
||||
|
||||
all: destroyuser
|
||||
|
||||
destroyuser:
|
||||
destroyuser: destroyuser.sh
|
||||
sed $(SEDSCRIPT) <destroyuser.sh >destroyuser
|
||||
|
||||
install: destroyuser
|
||||
|
@ -8,25 +8,12 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.4 1996/09/21 06:24:31 scrappy Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.5 1996/11/14 10:25:19 bryanh Exp $
|
||||
#
|
||||
# Note - this should NOT be setuid.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# ----------------
|
||||
# Set paths from environment or default values.
|
||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
||||
# from the default value for this build.
|
||||
# Currently the only thing we look for from the environment is
|
||||
# PGDATA, PGHOST, and PGPORT
|
||||
#
|
||||
# ----------------
|
||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
||||
PATH=$BINDIR:$PATH
|
||||
|
||||
CMDNAME=`basename $0`
|
||||
|
||||
if [ -z "$USER" ]; then
|
||||
@ -52,10 +39,25 @@ do
|
||||
shift;
|
||||
done
|
||||
|
||||
AUTHOPT="-a $AUTHSYS"
|
||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
||||
if [-z "$AUTHSYS" ]; then
|
||||
AUTHOPT = ""
|
||||
else
|
||||
AUTHOPT = "-a $AUTHSYS"
|
||||
fi
|
||||
|
||||
PARGS="-tq $AUTHOPT -p $PGPORT -h $PGHOST"
|
||||
if [-z "$PGHOST" ]; then
|
||||
PGHOSTOPT = ""
|
||||
else
|
||||
PGHOSTOPT = "-h $PGHOST"
|
||||
fi
|
||||
|
||||
if [-z "$PGPORT" ]; then
|
||||
PGPORTOPT = ""
|
||||
else
|
||||
PGPORTOPT = "-p $PGPORT"
|
||||
fi
|
||||
|
||||
PARGS="-tq $AUTHOPT $PGHOSTOPT $PGPORTOPT
|
||||
|
||||
#
|
||||
# generate the first part of the actual monitor command
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.2 1996/11/11 13:40:25 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.3 1996/11/14 10:25:22 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -15,16 +15,12 @@ SRCDIR= ../..
|
||||
include ../../Makefile.global
|
||||
|
||||
SEDSCRIPT= \
|
||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
||||
-e "s^_fUnKy_LIBDIR_sTuFf_^$(LIBDIR)^g" \
|
||||
-e "s^_fUnKy_DATADIR_sTuFf_^$(DATADIR)^g" \
|
||||
-e "s^_fUnKy_NAMEDATALEN_sTuFf_^$(NAMEDATALEN)^g" \
|
||||
-e "s^_fUnKy_OIDNAMELEN_sTuFf_^$(OIDNAMELEN)^g" \
|
||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
|
||||
-e "s^_fUnKy_OIDNAMELEN_sTuFf_^$(OIDNAMELEN)^g"
|
||||
|
||||
all: initdb
|
||||
|
||||
initdb:
|
||||
initdb: initdb.sh
|
||||
sed $(SEDSCRIPT) <initdb.sh >initdb
|
||||
|
||||
install: initdb
|
||||
|
@ -26,31 +26,32 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.12 1996/10/12 07:49:56 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.13 1996/11/14 10:25:33 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# ----------------
|
||||
# Set paths from environment or default values.
|
||||
# The _fUnKy_..._sTuFf_ gets set when the script is built (with make)
|
||||
# from parameters set in the make file.
|
||||
# Currently the only thing we look for from the environment is
|
||||
# PGDATA, PGHOST, and PGPORT. However, we should have environment
|
||||
# variables for all the paths.
|
||||
#
|
||||
# ----------------
|
||||
[ -z "$PGDATA" ] && { PGDATA=_fUnKy_DATADIR_sTuFf_; export PGDATA; }
|
||||
[ -z "$PGPORT" ] && { PGPORT=_fUnKy_POSTPORT_sTuFf_; export PGPORT; }
|
||||
[ -z "$PGHOST" ] && { PGHOST=localhost; export PGHOST; }
|
||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
||||
LIBDIR=_fUnKy_LIBDIR_sTuFf_
|
||||
|
||||
NAMEDATALEN=_fUnKy_NAMEDATALEN_sTuFf_
|
||||
OIDNAMELEN=_fUnKy_OIDNAMELEN_sTuFf_
|
||||
PATH=$BINDIR:$PATH
|
||||
export PATH
|
||||
|
||||
CMDNAME=`basename $0`
|
||||
|
||||
# Find the default PGLIB directory (the directory that contains miscellaneous
|
||||
# files that are part of Postgres). The user-written program postconfig
|
||||
# outputs variable settings like "PGLIB=/usr/lib/whatever". If it doesn't
|
||||
# output a PGLIB value, then there is no default and the user must
|
||||
# specify the pglib option. Postconfig may not exist, in which case
|
||||
# our invocation of it silently fails.
|
||||
|
||||
# The x=x below is to satisfy export if postconfig returns nothing.
|
||||
|
||||
export x=x $(postconfig 2>/dev/null)
|
||||
|
||||
# Set defaults:
|
||||
debug=0
|
||||
noclean=0
|
||||
@ -62,45 +63,60 @@ do
|
||||
# ${ARG#--username=} is not reliable or available on all platforms
|
||||
|
||||
case "$1" in
|
||||
--debug|-d)
|
||||
debug=1
|
||||
echo "Running with debug mode on."
|
||||
;;
|
||||
--noclean|-n)
|
||||
noclean=1
|
||||
echo "Running with noclean mode on. Mistakes will not be cleaned up."
|
||||
;;
|
||||
--template|-t)
|
||||
template_only=1
|
||||
echo "updating template1 database only."
|
||||
;;
|
||||
--username=*)
|
||||
POSTGRES_SUPERUSERNAME="`echo $1 | sed s/^--username=//`"
|
||||
;;
|
||||
-u)
|
||||
shift
|
||||
POSTGRES_SUPERUSERNAME="$1"
|
||||
;;
|
||||
-u*)
|
||||
POSTGRES_SUPERUSERNAME="`echo $1 | sed s/^-u//`"
|
||||
;;
|
||||
--pgdata=*)
|
||||
PGDATA="`echo $1 | sed s/^--pgdata=//`"
|
||||
;;
|
||||
-r)
|
||||
shift
|
||||
PGDATA="$1"
|
||||
;;
|
||||
-r*)
|
||||
PGDATA="`echo $1 | sed s/^-r//`"
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognized option '$1'. Syntax is:"
|
||||
echo "initdb [-t | --template] [-d | --debug] [-n | --noclean]" \
|
||||
"[-u SUPERUSER | --username=SUPERUSER] [-r DATADIR | --pgdata=DATADIR]"
|
||||
exit 100
|
||||
esac
|
||||
shift
|
||||
--debug|-d)
|
||||
debug=1
|
||||
echo "Running with debug mode on."
|
||||
;;
|
||||
--noclean|-n)
|
||||
noclean=1
|
||||
echo "Running with noclean mode on. "
|
||||
"Mistakes will not be cleaned up."
|
||||
;;
|
||||
--template|-t)
|
||||
template_only=1
|
||||
echo "updating template1 database only."
|
||||
;;
|
||||
--username=*)
|
||||
POSTGRES_SUPERUSERNAME="`echo $1 | sed s/^--username=//`"
|
||||
;;
|
||||
-u)
|
||||
shift
|
||||
POSTGRES_SUPERUSERNAME="$1"
|
||||
;;
|
||||
-u*)
|
||||
POSTGRES_SUPERUSERNAME="`echo $1 | sed s/^-u//`"
|
||||
;;
|
||||
--pgdata=*)
|
||||
PGDATA="`echo $1 | sed s/^--pgdata=//`"
|
||||
;;
|
||||
-r)
|
||||
shift
|
||||
PGDATA="$1"
|
||||
;;
|
||||
-r*)
|
||||
PGDATA="`echo $1 | sed s/^-r//`"
|
||||
;;
|
||||
--pglib=*)
|
||||
PGLIB="`echo $1 | sed s/^--pglib=//`"
|
||||
;;
|
||||
-l)
|
||||
shift
|
||||
PGLIB="$1"
|
||||
;;
|
||||
-l*)
|
||||
PGLIB="`echo $1 | sed s/^-l//`"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unrecognized option '$1'. Syntax is:"
|
||||
echo "initdb [-t | --template] [-d | --debug]" \
|
||||
"[-n | --noclean]" \
|
||||
"[-u SUPERUSER | --username=SUPERUSER]" \
|
||||
"[-r DATADIR | --pgdata=DATADIR]" \
|
||||
"[-l LIBDIR | --pglib=LIBDIR]"
|
||||
exit 100
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$debug" -eq 1 ]; then
|
||||
@ -109,9 +125,34 @@ else
|
||||
BACKENDARGS="-boot -C -F -Q"
|
||||
fi
|
||||
|
||||
TEMPLATE=$LIBDIR/local1_template1.bki.source
|
||||
GLOBAL=$LIBDIR/global1.bki.source
|
||||
PG_HBA_SAMPLE=$LIBDIR/pg_hba.conf.sample
|
||||
TEMPLATE=$PGLIB/local1_template1.bki.source
|
||||
GLOBAL=$PGLIB/global1.bki.source
|
||||
PG_HBA_SAMPLE=$PGLIB/pg_hba.conf.sample
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Make sure he told us where to find the Postgres files.
|
||||
#-------------------------------------------------------------------------
|
||||
if [ -z $PGLIB ]; then
|
||||
echo "$CMDNAME does not know where to find the files that make up "
|
||||
echo "Postgres (the PGLIB directory). You must identify the PGLIB "
|
||||
echo "directory either with a --pglib invocation option, or by "
|
||||
echo "setting the PGLIB environment variable, or by having a program "
|
||||
echo "called 'postconfig' in your search path that sets the PGLIB "
|
||||
echo "environment variable."
|
||||
exit 20
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Make sure he told us where to build the database system
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
if [ -z $PGDATA ]; then
|
||||
echo "$CMDNAME: You must identify the PGDATA directory, where the data"
|
||||
echo "for this database system will reside. Do this with either a"
|
||||
echo "--pgdata invocation option or a PGDATA environment variable."
|
||||
echo
|
||||
exit 20
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Find the input files
|
||||
@ -120,7 +161,9 @@ PG_HBA_SAMPLE=$LIBDIR/pg_hba.conf.sample
|
||||
for PREREQ_FILE in $TEMPLATE $GLOBAL $PG_HBA_SAMPLE; do
|
||||
if [ ! -f $PREREQ_FILE ]; then
|
||||
echo "$CMDNAME does not find the file '$PREREQ_FILE'."
|
||||
echo "This means Postgres95 is incorrectly installed."
|
||||
echo "This means you have identified an invalid PGLIB directory."
|
||||
echo "You specify a PGLIB directory with a --pglib invocation "
|
||||
echo "option, a PGLIB environment variable, or a postconfig program."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@ -157,15 +200,13 @@ fi
|
||||
if [ $POSTGRES_SUPERUID -ne `pg_id` -a `pg_id` -ne 0 ]; then
|
||||
echo "Only the unix superuser may initialize a database with a different"
|
||||
echo "Postgres superuser. (You must be able to create files that belong"
|
||||
echo "to the specified Postgres userid)."
|
||||
echo "to the specified unix user)."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "We are initializing the database system with username" \
|
||||
"$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)."
|
||||
echo "Please be aware that Postgres is not secure. Anyone who can connect"
|
||||
echo "to the database can act as user $POSTGRES_SUPERUSERNAME" \
|
||||
"with very little effort."
|
||||
echo "This user will own all the files and must also own the server process."
|
||||
echo
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
@ -182,8 +223,8 @@ if [ -d "$PGDATA" ]; then
|
||||
echo "database system already exists."
|
||||
echo
|
||||
echo "If you want to create a new database system, either remove "
|
||||
echo "the $PGDATA directory or run initdb with environment variable"
|
||||
echo "PGDATA set to something other than $PGDATA."
|
||||
echo "the $PGDATA directory or run initdb with a --pgdata option "
|
||||
echo "other than $PGDATA."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
|
@ -159,6 +159,14 @@
|
||||
/* OIDNAMELEN should be set to NAMEDATALEN + sizeof(Oid) */
|
||||
#define OIDNAMELEN 36
|
||||
|
||||
/*
|
||||
* DEF_PGPORT is the TCP port number on which the Postmaster listens by
|
||||
* default. This can be overriden by command options, environment variables,
|
||||
* and the postconfig hook.
|
||||
*/
|
||||
|
||||
#define DEF_PGPORT "5432"
|
||||
|
||||
/* turn this on if you prefer European style dates instead of American
|
||||
* style dates
|
||||
*/
|
||||
|
@ -4,7 +4,6 @@
|
||||
* this file contains general postgres administration and initialization
|
||||
* stuff that used to be spread out between the following files:
|
||||
* globals.h global variables
|
||||
* magic.h PG_RELEASE, PG_VERSION, etc defines
|
||||
* pdir.h directory path crud
|
||||
* pinit.h postgres initialization
|
||||
* pmod.h processing modes
|
||||
@ -12,7 +11,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: miscadmin.h,v 1.3 1996/11/12 06:47:10 bryanh Exp $
|
||||
* $Id: miscadmin.h,v 1.4 1996/11/14 10:25:42 bryanh Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the information in this file will be moved to
|
||||
@ -36,13 +35,12 @@ extern int PostmasterMain(int argc, char* argv[]);
|
||||
* from utils/init/globals.c
|
||||
*/
|
||||
extern int Portfd;
|
||||
extern int Noversion; /* moved from magic.c */
|
||||
extern int MasterPid; /* declared and defined in utils/initglobals.c */
|
||||
extern int Noversion;
|
||||
extern int MasterPid;
|
||||
extern int Quiet;
|
||||
extern char *DataDir;
|
||||
|
||||
extern char OutputFileName[];
|
||||
extern void InitGlobals(void);
|
||||
|
||||
/*
|
||||
* done in storage/backendid.h for now.
|
||||
@ -83,8 +81,6 @@ extern char *GetPgUserName(void);
|
||||
extern void SetPgUserName(void);
|
||||
extern Oid GetUserId(void);
|
||||
extern void SetUserId(void);
|
||||
extern char *GetPGHome(void);
|
||||
extern char *GetPGData(void);
|
||||
extern int ValidateBackend(char *path);
|
||||
extern int FindBackend(char *backend, char *argv0);
|
||||
extern int CheckPathAccess(char *path, char *name, int open_mode);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.3 1996/11/13 10:35:39 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.4 1996/11/14 10:25:54 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -21,7 +21,7 @@ INCLUDE_OPT= \
|
||||
-I../include \
|
||||
-I$(LIBPQDIR)
|
||||
|
||||
CXXFLAGS+= $(INCLUDE_OPT) -DPOSTPORT='"$(POSTPORT)"'
|
||||
CXXFLAGS+= $(INCLUDE_OPT)
|
||||
|
||||
ifdef KRBVERS
|
||||
CXXFLAGS+= $(KRBFLAGS)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.16 1996/11/12 11:42:21 bryanh Exp $
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.17 1996/11/14 10:25:48 bryanh Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -17,7 +17,7 @@ include ../Makefile.global
|
||||
# We need the backend directory here for its fmgr.h
|
||||
INCLUDE_OPT= -I../include -I../backend
|
||||
|
||||
CFLAGS+= $(INCLUDE_OPT) -DPOSTPORT='"$(POSTPORT)"'
|
||||
CFLAGS+= $(INCLUDE_OPT)
|
||||
|
||||
ifdef KRBVERS
|
||||
CFLAGS+= $(KRBFLAGS)
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.18 1996/11/11 12:16:54 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.19 1996/11/14 10:25:50 bryanh Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -63,7 +63,7 @@ static void conninfo_free(void);
|
||||
|
||||
|
||||
/* ----------
|
||||
* Definition of the conninfo parametes and their fallback resources.
|
||||
* Definition of the conninfo parameters and their fallback resources.
|
||||
* If Environment-Var and Compiled-in are specified as NULL, no
|
||||
* fallback is available. If after all no value can be determined
|
||||
* for an option, an error is returned.
|
||||
@ -93,7 +93,7 @@ static PQconninfoOption PQconninfoOptions[] = {
|
||||
{ "host", "PGHOST", DefaultHost, NULL,
|
||||
"Database-Host", "", 40 },
|
||||
|
||||
{ "port", "PGPORT", POSTPORT, NULL,
|
||||
{ "port", "PGPORT", DEF_PGPORT, NULL,
|
||||
"Database-Port", "", 6 },
|
||||
|
||||
{ "tty", "PGTTY", DefaultTty, NULL,
|
||||
@ -192,7 +192,6 @@ PQconnectdb(const char *conninfo)
|
||||
conn->Pfdebug = NULL;
|
||||
conn->port = NULL;
|
||||
conn->notifyList = DLNewList();
|
||||
conn->lobjfuncs = NULL;
|
||||
|
||||
conn->pghost = strdup(conninfo_getval("host"));
|
||||
conn->pgport = strdup(conninfo_getval("port"));
|
||||
@ -300,7 +299,6 @@ PQsetdb(const char *pghost, const char* pgport, const char* pgoptions, const cha
|
||||
conn->Pfdebug = NULL;
|
||||
conn->port = NULL;
|
||||
conn->notifyList = DLNewList();
|
||||
conn->lobjfuncs = NULL;
|
||||
|
||||
if (!pghost || pghost[0] == '\0') {
|
||||
if (!(tmp = getenv("PGHOST"))) {
|
||||
@ -312,7 +310,7 @@ PQsetdb(const char *pghost, const char* pgport, const char* pgoptions, const cha
|
||||
|
||||
if (!pgport || pgport[0] == '\0') {
|
||||
if (!(tmp = getenv("PGPORT"))) {
|
||||
tmp = POSTPORT;
|
||||
tmp = DEF_PGPORT;
|
||||
}
|
||||
conn->pgport = strdup(tmp);
|
||||
} else
|
||||
@ -521,7 +519,6 @@ freePGconn(PGconn *conn)
|
||||
if (conn->dbName) free(conn->dbName);
|
||||
if (conn->pguser) free(conn->pguser);
|
||||
if (conn->notifyList) DLFreeList(conn->notifyList);
|
||||
if (conn->lobjfuncs) free(conn->lobjfuncs);
|
||||
free(conn);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user