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

Commita54ba52

Browse files
author
Thomas G. Lockhart
committed
Properly interpret environment variables passed as the input location.
1 parent86234a0 commita54ba52

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎src/bin/initlocation/initlocation.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
#
1313
#
1414
# 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 $
1616
#
1717
#-------------------------------------------------------------------------
1818

1919
CMDNAME=`basename$0`
20+
POSTGRES_SUPERUSERNAME=$USER
2021

2122
while ["$#"-gt 0 ]
2223
do
@@ -48,6 +49,13 @@ fi
4849
# Make sure he told us where to build the database area
4950
#-------------------------------------------------------------------------
5051

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+
5159
if [-z"$PGALTDATA" ];then
5260
echo"$CMDNAME: You must identify the target area, where the new data"
5361
echo"for this database system can reside. Do this with --location"
@@ -58,11 +66,6 @@ fi
5866
# Figure out who the Postgres superuser for the new database system will be.
5967
#---------------------------------------------------------------------------
6068

61-
if [ 1-eq 0 ];then
62-
if [-z"$POSTGRES_SUPERUSERNAME" ];then
63-
$POSTGRES_SUPERUSERNAME=pg_id
64-
fi
65-
6669
if [-z"$POSTGRES_SUPERUSERNAME" ];then
6770
echo"Can't tell what username to use. You don't have the USER"
6871
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" \
9194
"$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)."
9295
echo"This user will own all the files and must also own the server process."
9396
echo
94-
fi
9597

9698
# -----------------------------------------------------------------------
9799
# Create the data directory if necessary
@@ -105,12 +107,14 @@ if [ ! -d $PGALTDATA ]; then
105107
echo
106108
mkdir$PGALTDATA
107109
if [$?-ne 0 ];thenexit 1;fi
110+
chown$POSTGRES_SUPERUSERNAME$PGALTDATA
108111
fi
109112
if [!-d$PGALTDATA/base ];then
110113
echo"Creating Postgres database system directory$PGALTDATA/base"
111114
echo
112115
mkdir$PGALTDATA/base
113116
if [$?-ne 0 ];thenexit 1;fi
117+
chown$POSTGRES_SUPERUSERNAME$PGALTDATA/base
114118
fi
115119

116120
exit

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp