File: fixture-tablespace-setup

package info (click to toggle)
osm2pgsql 2.1.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,652 kB
  • sloc: cpp: 59,934; python: 1,039; ansic: 763; sh: 25; makefile: 14
file content (25 lines) | stat: -rwxr-xr-x 639 bytes parent folder | download | duplicates (7)
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
#!/bin/sh
#
# Creates the required tablespace for tests.
#
# Only do this when we are running under pg_virtualenv.
# Then the tablespace can be owned by the current user.

if [ "x$PG_CLUSTER_CONF_ROOT" != "x" ]; then
    BASEDIR=`pwd`

    TBLDIR=${BASEDIR}/osm2pgsql-test-tablespace

    if [ -d "$TBLDIR" ]; then
        echo "Tablespace directory already exists. Cleaning up."

        if find $TBLDIR -maxdepth 1 -mindepth 1 -type d -name 'PG*'; then
            rm -r $TBLDIR/PG*
        fi
    else
        mkdir $TBLDIR
        chmod 777 $TBLDIR
    fi

    psql -c "CREATE TABLESPACE tablespacetest LOCATION '$TBLDIR'" postgres
fi