1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Here's a patch that I discussed recently on pg95-dev that changes the

way one creates a database system.  Parts that were in "make install"
are not either in "make all" or initdb.  Nothing goes in the PGDATA
directory besides user data.  Creating multiple database systems is
easier.

In addition to applying the patch, it is necessary to move the file
libpq/pg_hba to backend/libpq/pg_hba.sample.

Submitted by: Bryan Henderson <bryanh@giraffe.netgate.net>
This commit is contained in:
Marc G. Fournier
1996-09-23 08:24:13 +00:00
parent e7c3adcd94
commit ff4d0d435e
8 changed files with 321 additions and 302 deletions

View File

@@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.6 1996/09/21 06:27:11 scrappy Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.7 1996/09/23 08:21:52 scrappy Exp $
#
#-------------------------------------------------------------------------
@@ -17,13 +17,11 @@
# in your custom makefile, ../Makefile.custom.)
BIGOBJS= true
PROG= postgres
PROG= postgres global1.bki.source local1_template1.bki.source
MKDIR= ../mk
include $(MKDIR)/postgres.mk
include $(CURDIR)/access/Makefile.inc
include $(CURDIR)/bootstrap/Makefile.inc
include $(CURDIR)/catalog/Makefile.inc
@@ -60,6 +58,7 @@ OBJS:= $(subst .s,.o,$(SRCS:%.c=$(objdir)/%.o))
CLEANFILES+= $(notdir $(OBJS))
endif
#############################################################################
#
# TIOGA stuff
@@ -86,7 +85,7 @@ CFLAGS+= -DPOSTGRESDIR='"$(POSTGRESDIR)"' \
-I$(CURDIR)/$(objdir) \
-I$(CURDIR)/include \
-I$(CURDIR)/port/$(PORTNAME) \
-I$(SRCDIR)/include
-I../include
# turn this on if you prefer European style dates instead of American
# style dates
@@ -192,52 +191,33 @@ endif
#
# Installation.
#
# Install the bki files to the data directory. We also copy a version
# of them that has "PGUID" intact, so one can change the value of the
# postgres userid before running initdb in the case of customizing the
# binary release (i.e., fixing up PGUID w/o recompiling the system).
# Those files are copied out as foo.source. The program newbki(1) can
# be run later to reset the postgres login id (but it must be run before
# initdb is run, or after clearing the data directory with
# cleardbdir(1)). [newbki distributed with v4r2 but not with Postgres95.]
# Install the backend program (postgres) to the binary directory and
# make a link as "postmaster". Install the bki files templates and sample
# files to the library directory.
#
# (History: Before Release 2, make install generated a bki.source file
# and then used build parameters to convert it to a bki file, then installed
# that bki file in the /files subdirectory of the default data directory.
# Initdb then used the bki file to generate the database catalog classes.
# That had to change because (1) there can be more than one database system,
# and (2) the parameters of a database system should be set at initdb time,
# not at postgres build time.
# NAMEDATALEN=`egrep "^#define NAMEDATALEN" $(CURDIR)/include/postgres.h | awk '{print $$3}'`; \
# OIDNAMELEN=`egrep "^#define OIDNAMELEN" $(CURDIR)/include/postgres.h | awk '{print $$3}'`; \
install: beforeinstall pg_id $(BKIFILES) postgres
$(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/postgres $(DESTDIR)$(BINDIR)/postgres
install: beforeinstall postgres fmgr.h\
global1.bki.source local1_template1.bki.source \
libpq/pg_hba.sample
$(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/postgres \
$(DESTDIR)$(BINDIR)/postgres
@rm -f $(DESTDIR)$(BINDIR)/postmaster
cd $(DESTDIR)$(BINDIR); ln -s postgres postmaster
@cd $(objdir); \
PG_UID=`./pg_id $(POSTGRESLOGIN)`; \
POSTGRESLOGIN=$(POSTGRESLOGIN);\
echo "NAMEDATALEN = $(NAMEDATALEN)"; \
echo "OIDNAMELEN = $(OIDNAMELEN)"; \
case $$PG_UID in "NOUSER") \
echo "Warning: no account named $(POSTGRESLOGIN), using yours";\
POSTGRESLOGIN=`whoami`; \
PG_UID=`./pg_id`;; \
esac ;\
for bki in $(BKIFILES); do \
sed \
-e "s/postgres PGUID/$$POSTGRESLOGIN $$PG_UID/" \
-e "s/NAMEDATALEN/$(NAMEDATALEN)/g" \
-e "s/OIDNAMELEN/$(OIDNAMELEN)/g" \
-e "s/PGUID/$$PG_UID/" \
< $$bki > $$bki.sed ; \
echo "Installing $(DESTDIR)$(DATADIR)/files/$$bki."; \
$(INSTALL) $(INSTLOPTS) \
$$bki.sed $(DESTDIR)$(DATADIR)/files/$$bki; \
rm -f $$bki.sed; \
echo "Installing $(DESTDIR)$(DATADIR)/files/$$bki.source."; \
$(INSTALL) $(INSTLOPTS) \
$$bki $(DESTDIR)$(DATADIR)/files/$$bki.source; \
done;
@echo "Installing $(DATADIR)/pg_hba";
@cp $(srcdir)/libpq/pg_hba $(DATADIR)
@chmod 644 $(DATADIR)/pg_hba
$(INSTALL) $(INSTLOPTS) $(objdir)/fmgr.h $(HEADERDIR)/fmgr.h
$(INSTALL) $(INSTLOPTS) $(objdir)/global1.bki.source \
$(DESTDIR)$(LIBDIR)/global1.bki.source
$(INSTALL) $(INSTLOPTS) $(objdir)/local1_template1.bki.source \
$(DESTDIR)$(LIBDIR)/local1_template1.bki.source
$(INSTALL) $(INSTLOPTS) libpq/pg_hba.sample \
$(DESTDIR)$(LIBDIR)/pg_hba.sample
# so we can get the UID of the postgres owner (w/o moving pg_id to
# src/tools). We just want the vanilla LDFLAGS for pg_id
@@ -247,10 +227,8 @@ ifeq ($(CC), cc)
IDLDFLAGS+= -Aa -D_HPUX_SOURCE
endif
endif
pg_id: $(srcdir)/bin/pg_id/pg_id.c
$(CC) $(IDLDFLAGS) -o $(objdir)/$(@F) $<
CLEANFILES+= pg_id postgres
CLEANFILES+= postgres
#############################################################################

View File

@@ -7,13 +7,14 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/Makefile.inc,v 1.1.1.1 1996/07/09 06:21:14 scrappy Exp $
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/Makefile.inc,v 1.2 1996/09/23 08:22:04 scrappy Exp $
#
#-------------------------------------------------------------------------
catdir=$(CURDIR)/catalog
VPATH:=$(VPATH):$(catdir)
cat_hdr_dir= ../include/catalog
SRCS_CATALOG= catalog.c heap.c index.c indexing.c \
pg_aggregate.c pg_operator.c pg_proc.c pg_type.c
@@ -28,7 +29,7 @@ HEADERS+= catalog.h catname.h heap.h index.h indexing.h pg_aggregate.h \
pg_user.h pg_variable.h pg_version.h
#
# The following is to create the .bki files.
# The following is to create the .bki.source files.
# TODO: sort headers, (figure some automatic way of of determining
# the bki sources?)
#
@@ -41,29 +42,27 @@ BKIOPTS= -DALLOW_PG_GROUP
endif
GENBKI= $(catdir)/genbki.sh
BKIFILES= global1.bki local1_template1.bki
GLOBALBKI_SRCS= pg_database.h pg_demon.h pg_magic.h pg_defaults.h \
pg_variable.h pg_server.h pg_user.h pg_hosts.h \
pg_group.h pg_log.h pg_time.h
GLOBALBKI_SRCS= $(addprefix $(cat_hdr_dir)/, \
pg_database.h pg_demon.h pg_magic.h pg_defaults.h \
pg_variable.h pg_server.h pg_user.h pg_hosts.h \
pg_group.h pg_log.h pg_time.h \
)
LOCALBKI_SRCS= pg_proc.h pg_type.h pg_attribute.h pg_class.h \
pg_inherits.h pg_index.h pg_version.h pg_statistic.h pg_operator.h \
pg_opclass.h pg_am.h pg_amop.h pg_amproc.h pg_language.h pg_parg.h \
pg_aggregate.h pg_ipl.h pg_inheritproc.h \
pg_rewrite.h pg_listener.h indexing.h
LOCALBKI_SRCS= $(addprefix $(cat_hdr_dir)/, \
pg_proc.h pg_type.h pg_attribute.h pg_class.h \
pg_inherits.h pg_index.h pg_version.h pg_statistic.h \
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
pg_language.h pg_parg.h \
pg_aggregate.h pg_ipl.h pg_inheritproc.h \
pg_rewrite.h pg_listener.h indexing.h \
)
global1.bki: $(GENBKI) $(GLOBALBKI_SRCS)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) \
$(patsubst $(GENBKI),,$^) > $(objdir)/$(@F)
global1.bki.source: $(GENBKI) $(GLOBALBKI_SRCS)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(GLOBALBKI_SRCS) > $(objdir)/$(@F)
local1_template1.bki.source: $(GENBKI) $(LOCALBKI_SRCS)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(LOCALBKI_SRCS) > $(objdir)/$(@F)
local1_template1.bki: $(GENBKI) $(LOCALBKI_SRCS)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) \
$(patsubst $(GENBKI),,$^) > $(objdir)/$(@F)
CLEANFILES+= global.bki.source local1_template1.bki.source
#${PROG}: ${BKIFILES}
#
CLEANFILES+= ${BKIFILES}

View File

@@ -0,0 +1,13 @@
#
# Example config file for Postgres95 host based access
#
# Lines starting with "all" apply to all databases. Otherwise the first
# column has to match the name of the database being connected to. Up to
# ten config lines can apply to each database. Mask specifies bits that
# aren't counted. After those bits are taken out, the connection address
# must match the address in the middle column.
#
# <name> <address> <mask>
#
all 127.0.0.1 0.0.0.0