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 5672 aaronmk
    echo "Usage: env [data=1] [plain=1] [owners=1] [opts=...] $0 \
8
{<schema>|all} [opts...] >out"|fold -s >&2
9 2092 aaronmk
    exit 2
10
fi
11 3397 aaronmk
12 3406 aaronmk
schema="$1"
13
shift
14
test "$schema" != all && set -- --schema="\"$schema\"" "$@"
15 3400 aaronmk
16 3388 aaronmk
if test -n "$data"; then
17 3401 aaronmk
    if test -n "$plain"; then set -- "$@" --format=p
18
    else set -- "$@" --format=c --compress=9
19 3388 aaronmk
    fi
20 3397 aaronmk
    owners=1
21 3401 aaronmk
else set -- "$@" --schema-only
22 3388 aaronmk
fi
23 3401 aaronmk
test -n "$owners" || set -- "$@" --no-owner --no-privileges
24 5672 aaronmk
set -- "$@" $opts
25 2092 aaronmk
26 3401 aaronmk
set -x
27
exec "$selfDir/postgres_vegbien" pg_dump "$@"