File: postgis_env.sh.in

package info (click to toggle)
postgis 3.5.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 70,052 kB
  • sloc: ansic: 162,204; sql: 93,950; xml: 53,121; cpp: 12,646; perl: 5,658; sh: 5,369; makefile: 3,434; python: 1,205; yacc: 447; lex: 151; pascal: 58
file content (66 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (14)
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