Project

General

Profile

1 2092 aaronmk
#!/bin/sh
2
# Dumps a schema of the vegbien db
3
4
selfDir="$(dirname -- "$0")"
5
6
if ! test "$#" -eq 1; then
7 3400 aaronmk
    echo "Usage: env [data=1] [plain=1] [owners=1] $0 [schema] [opts...] >out"
8 2092 aaronmk
    exit 2
9
fi
10 3397 aaronmk
11 3400 aaronmk
if test "${1#-}" = "$1"; then # $1 does not start with "-"
12
    schemaOpt=--schema="\"$1\""
13
    shift
14
    set -- "$schemaOpt" "$@"
15
fi
16
17 3388 aaronmk
if test -n "$data"; then
18 3401 aaronmk
    if test -n "$plain"; then set -- "$@" --format=p
19
    else set -- "$@" --format=c --compress=9
20 3388 aaronmk
    fi
21 3397 aaronmk
    owners=1
22 3401 aaronmk
else set -- "$@" --schema-only
23 3388 aaronmk
fi
24 3401 aaronmk
test -n "$owners" || set -- "$@" --no-owner --no-privileges
25
set -- "$@" --use-set-session-authorization
26 2092 aaronmk
27 3401 aaronmk
set -x
28
exec "$selfDir/postgres_vegbien" pg_dump "$@"