Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5417a3

Browse files
author
Thomas G. Lockhart
committed
Create alternate location(s) for databases.
1 parent951986c commitb5417a3

File tree

3 files changed

+264
-0
lines changed

3 files changed

+264
-0
lines changed

‎src/bin/initlocation/Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile.inc--
4+
# Makefile for bin/initlocation
5+
#
6+
# Copyright (c) 1994, Regents of the University of California
7+
#
8+
#
9+
# IDENTIFICATION
10+
# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/Makefile,v 1.1 1997/11/07 06:21:34 thomas Exp $
11+
#
12+
#-------------------------------------------------------------------------
13+
14+
SRCDIR= ../..
15+
include ../../Makefile.global
16+
17+
SEDSCRIPT=\
18+
-e "s^_fUnKy_NAMEDATALEN_sTuFf_^$(NAMEDATALEN)^g"\
19+
-e "s^_fUnKy_OIDNAMELEN_sTuFf_^$(OIDNAMELEN)^g"
20+
21+
all: initlocation
22+
23+
initlocation: initlocation.sh
24+
cp -p initlocation.sh initlocation
25+
26+
install: initlocation
27+
$(INSTALL)$(INSTL_EXE_OPTS)$<$(DESTDIR)$(BINDIR)/$<
28+
29+
clean:
30+
rm -f initlocation
31+
32+
dep:

‎src/bin/initlocation/initlocation

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/sh
2+
#-------------------------------------------------------------------------
3+
#
4+
# initarea.sh--
5+
# Create (initialize) a secondary Postgres database storage area.
6+
#
7+
# A database storage area contains individual Postgres databases.
8+
#
9+
# To create the database storage area, we create a root directory tree.
10+
#
11+
# Copyright (c) 1994, Regents of the University of California
12+
#
13+
#
14+
# IDENTIFICATION
15+
# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation,v 1.1 1997/11/07 06:21:38 thomas Exp $
16+
#
17+
#-------------------------------------------------------------------------
18+
19+
CMDNAME=`basename$0`
20+
21+
while ["$#"-gt 0 ]
22+
do
23+
case"$1"in
24+
--location=*) PGALTDATA="`echo$1| sed's/^--pgdata=//'`"; ;;
25+
--username=*) POSTGRES_SUPERUSERNAME="`echo$1| sed's/^--username=//'`" ;;
26+
27+
--location)shift; PGALTDATA="$1"; ;;
28+
--username)shift; POSTGRES_SUPERUSERNAME="$1"; ;;
29+
30+
-u)shift; POSTGRES_SUPERUSERNAME="$1"; ;;
31+
-D)shift; PGALTDATA="$1"; ;;
32+
-*) badparm=$1; usage=1; ;;
33+
*) PGALTDATA="$1"; ;;
34+
esac
35+
shift
36+
done
37+
38+
if [!-z"$badparm" ];then
39+
echo"$CMDNAME: Unrecognized parameter '$badparm'"
40+
fi
41+
42+
if [!-z"$usage" ];then
43+
echo"Usage:$CMDNAME [-u SUPERUSER] DATADIR"
44+
exit 1
45+
fi
46+
47+
#-------------------------------------------------------------------------
48+
# Make sure he told us where to build the database area
49+
#-------------------------------------------------------------------------
50+
51+
if [-z"$PGALTDATA" ];then
52+
echo"$CMDNAME: You must identify the target area, where the new data"
53+
echo"for this database system can reside. Do this with --location"
54+
exit 1
55+
fi
56+
57+
#---------------------------------------------------------------------------
58+
# Figure out who the Postgres superuser for the new database system will be.
59+
#---------------------------------------------------------------------------
60+
61+
if [ 1-eq 0 ];then
62+
if [-z"$POSTGRES_SUPERUSERNAME" ];then
63+
$POSTGRES_SUPERUSERNAME=pg_id
64+
fi
65+
66+
if [-z"$POSTGRES_SUPERUSERNAME" ];then
67+
echo"Can't tell what username to use. You don't have the USER"
68+
echo"environment variable set to your username and didn't specify the"
69+
echo"--username option"
70+
exit 1
71+
fi
72+
73+
POSTGRES_SUPERUID=`pg_id$POSTGRES_SUPERUSERNAME`
74+
75+
if [$POSTGRES_SUPERUID= NOUSER ];then
76+
echo"Valid username not given. You must specify the username for"
77+
echo"the Postgres superuser for the database system you are"
78+
echo"initializing, either with the --username option or by default"
79+
echo"to the USER environment variable."
80+
exit 1
81+
fi
82+
83+
if [$POSTGRES_SUPERUID-ne`pg_id`-a`pg_id`-ne 0 ];then
84+
echo"Only the unix superuser may initialize a database with a different"
85+
echo"Postgres superuser. (You must be able to create files that belong"
86+
echo"to the specified unix user)."
87+
exit 1
88+
fi
89+
90+
echo"We are initializing the database area with username" \
91+
"$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)."
92+
echo"This user will own all the files and must also own the server process."
93+
echo
94+
fi
95+
96+
# -----------------------------------------------------------------------
97+
# Create the data directory if necessary
98+
# -----------------------------------------------------------------------
99+
100+
# umask must disallow access to group, other for files and dirs
101+
umask 077
102+
103+
if [!-d$PGALTDATA ];then
104+
echo"Creating Postgres database system directory$PGALTDATA"
105+
echo
106+
mkdir$PGALTDATA
107+
if [$?-ne 0 ];thenexit 1;fi
108+
fi
109+
if [!-d$PGALTDATA/base ];then
110+
echo"Creating Postgres database system directory$PGALTDATA/base"
111+
echo
112+
mkdir$PGALTDATA/base
113+
if [$?-ne 0 ];thenexit 1;fi
114+
fi
115+
116+
exit

‎src/bin/initlocation/initlocation.sh

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/sh
2+
#-------------------------------------------------------------------------
3+
#
4+
# initarea.sh--
5+
# Create (initialize) a secondary Postgres database storage area.
6+
#
7+
# A database storage area contains individual Postgres databases.
8+
#
9+
# To create the database storage area, we create a root directory tree.
10+
#
11+
# Copyright (c) 1994, Regents of the University of California
12+
#
13+
#
14+
# IDENTIFICATION
15+
# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.1 1997/11/07 06:21:39 thomas Exp $
16+
#
17+
#-------------------------------------------------------------------------
18+
19+
CMDNAME=`basename$0`
20+
21+
while ["$#"-gt 0 ]
22+
do
23+
case"$1"in
24+
--location=*) PGALTDATA="`echo$1| sed's/^--pgdata=//'`"; ;;
25+
--username=*) POSTGRES_SUPERUSERNAME="`echo$1| sed's/^--username=//'`" ;;
26+
27+
--location)shift; PGALTDATA="$1"; ;;
28+
--username)shift; POSTGRES_SUPERUSERNAME="$1"; ;;
29+
30+
-u)shift; POSTGRES_SUPERUSERNAME="$1"; ;;
31+
-D)shift; PGALTDATA="$1"; ;;
32+
-*) badparm=$1; usage=1; ;;
33+
*) PGALTDATA="$1"; ;;
34+
esac
35+
shift
36+
done
37+
38+
if [-n"$badparm" ];then
39+
echo"$CMDNAME: Unrecognized parameter '$badparm'"
40+
fi
41+
42+
if [-n"$usage" ];then
43+
echo"Usage:$CMDNAME [-u SUPERUSER] DATADIR"
44+
exit 1
45+
fi
46+
47+
#-------------------------------------------------------------------------
48+
# Make sure he told us where to build the database area
49+
#-------------------------------------------------------------------------
50+
51+
if [-z"$PGALTDATA" ];then
52+
echo"$CMDNAME: You must identify the target area, where the new data"
53+
echo"for this database system can reside. Do this with --location"
54+
exit 1
55+
fi
56+
57+
#---------------------------------------------------------------------------
58+
# Figure out who the Postgres superuser for the new database system will be.
59+
#---------------------------------------------------------------------------
60+
61+
if [ 1-eq 0 ];then
62+
if [-z"$POSTGRES_SUPERUSERNAME" ];then
63+
$POSTGRES_SUPERUSERNAME=pg_id
64+
fi
65+
66+
if [-z"$POSTGRES_SUPERUSERNAME" ];then
67+
echo"Can't tell what username to use. You don't have the USER"
68+
echo"environment variable set to your username and didn't specify the"
69+
echo"--username option"
70+
exit 1
71+
fi
72+
73+
POSTGRES_SUPERUID=`pg_id$POSTGRES_SUPERUSERNAME`
74+
75+
if [$POSTGRES_SUPERUID= NOUSER ];then
76+
echo"Valid username not given. You must specify the username for"
77+
echo"the Postgres superuser for the database system you are"
78+
echo"initializing, either with the --username option or by default"
79+
echo"to the USER environment variable."
80+
exit 1
81+
fi
82+
83+
if [$POSTGRES_SUPERUID-ne`pg_id`-a`pg_id`-ne 0 ];then
84+
echo"Only the unix superuser may initialize a database with a different"
85+
echo"Postgres superuser. (You must be able to create files that belong"
86+
echo"to the specified unix user)."
87+
exit 1
88+
fi
89+
90+
echo"We are initializing the database area with username" \
91+
"$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)."
92+
echo"This user will own all the files and must also own the server process."
93+
echo
94+
fi
95+
96+
# -----------------------------------------------------------------------
97+
# Create the data directory if necessary
98+
# -----------------------------------------------------------------------
99+
100+
# umask must disallow access to group, other for files and dirs
101+
umask 077
102+
103+
if [!-d$PGALTDATA ];then
104+
echo"Creating Postgres database system directory$PGALTDATA"
105+
echo
106+
mkdir$PGALTDATA
107+
if [$?-ne 0 ];thenexit 1;fi
108+
fi
109+
if [!-d$PGALTDATA/base ];then
110+
echo"Creating Postgres database system directory$PGALTDATA/base"
111+
echo
112+
mkdir$PGALTDATA/base
113+
if [$?-ne 0 ];thenexit 1;fi
114+
fi
115+
116+
exit

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp