1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#!/bin/sh
# environment variables for postgis
#read optional configuration files. last prevails
for file in "/etc/default/postgis" "$HOME/.postgis/profile" ; do
if [ -f "$file" ]; then
tmpval=`grep "^TEMPLATEDB=" $file | cut -d= -f2`
if [ -n "$tmpval" ]; then
TEMPLATEDB1=$tmpval
fi
tmpval=`grep "^GRUSER=" $file | cut -d= -f2`
if [ -n "$tmpval" ]; then
GRUSER1=$tmpval
fi
tmpval=`grep "^DBAUSER=" $file | cut -d= -f2`
if [ -n "$tmpval" ]; then
DBAUSER1=$tmpval
fi
tmpval=`grep "^PGISSCRIPT=" $file | cut -d= -f2`
if [ -n "$tmpval" ]; then
PGISSCRIPT1=$tmpval
fi
fi
done
#cluster information should be set separately
if [ -x @prefix@/bin/pg_lsclusters ]; then
# PGCLUSTER=`pg_lsclusters | awk '{if ($3 == ENVIRON["PGPORT"]) {print $1"/"$2;}}'`
# export PGCLUSTER
#
if [ -z $DBAUSER ]; then
DBAUSER=`pg_lsclusters | awk '{if ($3 == ENVIRON["PGPORT"]) {print $5;}}'`
fi
fi
if [ -z "$TEMPLATEDB" ]; then
if [ -n "$TEMPLATEDB1" ]; then
TEMPLATEDB="$TEMPLATEDB1"
else
TEMPLATEDB="template_gis"
fi
fi
if [ -z "$GRUSER" ]; then
if [ -n "$GRUSER1" ]; then
GRUSER="$GRUSER1"
else
GRUSER="postgres"
fi
fi
if [ -z "$DBAUSER" ]; then
if [ -n "$DBAUSER1" ]; then
DBAUSER="$DBAUSER1"
else
DBAUSER="postgres"
fi
fi
if [ -z "$PGISSCRIPT" ]; then
if [ -n "$PGISSCRIPT1" ]; then
PGISSCRIPT="$PGISSCRIPT1"
else
PGISSCRIPT="postgis.sql"
fi
fi
TDB=$TEMPLATEDB
|