12
12
#
13
13
#
14
14
# IDENTIFICATION
15
- # $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.1 1997/11/07 06:21:39 thomas Exp $
15
+ # $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.2 1998/10/05 02:51:21 thomas Exp $
16
16
#
17
17
# -------------------------------------------------------------------------
18
18
19
19
CMDNAME=` basename$0 `
20
+ POSTGRES_SUPERUSERNAME=$USER
20
21
21
22
while [" $# " -gt 0 ]
22
23
do
48
49
# Make sure he told us where to build the database area
49
50
# -------------------------------------------------------------------------
50
51
52
+ PGENVAR=" $PGALTDATA "
53
+ PGENVAR=` printenv$PGENVAR `
54
+ if [! -z " $PGENVAR " ]; then
55
+ PGALTDATA=$PGENVAR
56
+ echo " $CMDNAME : input argument points to$PGALTDATA "
57
+ fi
58
+
51
59
if [-z " $PGALTDATA " ]; then
52
60
echo " $CMDNAME : You must identify the target area, where the new data"
53
61
echo " for this database system can reside. Do this with --location"
58
66
# Figure out who the Postgres superuser for the new database system will be.
59
67
# ---------------------------------------------------------------------------
60
68
61
- if [ 1-eq 0 ]; then
62
- if [-z " $POSTGRES_SUPERUSERNAME " ]; then
63
- $POSTGRES_SUPERUSERNAME =pg_id
64
- fi
65
-
66
69
if [-z " $POSTGRES_SUPERUSERNAME " ]; then
67
70
echo " Can't tell what username to use. You don't have the USER"
68
71
echo " environment variable set to your username and didn't specify the"
@@ -91,7 +94,6 @@ echo "We are initializing the database area with username" \
91
94
" $POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID )."
92
95
echo " This user will own all the files and must also own the server process."
93
96
echo
94
- fi
95
97
96
98
# -----------------------------------------------------------------------
97
99
# Create the data directory if necessary
@@ -105,12 +107,14 @@ if [ ! -d $PGALTDATA ]; then
105
107
echo
106
108
mkdir$PGALTDATA
107
109
if [$? -ne 0 ]; then exit 1; fi
110
+ chown$POSTGRES_SUPERUSERNAME $PGALTDATA
108
111
fi
109
112
if [! -d $PGALTDATA /base ]; then
110
113
echo " Creating Postgres database system directory$PGALTDATA /base"
111
114
echo
112
115
mkdir$PGALTDATA /base
113
116
if [$? -ne 0 ]; then exit 1; fi
117
+ chown$POSTGRES_SUPERUSERNAME $PGALTDATA /base
114
118
fi
115
119
116
120
exit