Project

General

Profile

1
#!/bin/sh
2
# Dumps a schema of the vegbien db
3

    
4
selfDir="$(dirname -- "$0")"
5

    
6
if ! test "$#" -eq 1; then
7
    echo "Usage: env [data=1] [plain=1] [owners=1] $0 [schema] [opts...] >out"\
8
    |fold -s >&2
9
    exit 2
10
fi
11

    
12
if test "${1#-}" = "$1"; then # $1 does not start with "-"
13
    schemaOpt=--schema="\"$1\""
14
    shift
15
    set -- "$schemaOpt" "$@"
16
fi
17

    
18
if test -n "$data"; then
19
    if test -n "$plain"; then set -- "$@" --format=p
20
    else set -- "$@" --format=c --compress=9
21
    fi
22
    owners=1
23
else set -- "$@" --schema-only
24
fi
25
test -n "$owners" || set -- "$@" --no-owner --no-privileges
26
set -- "$@" --use-set-session-authorization
27

    
28
set -x
29
exec "$selfDir/postgres_vegbien" pg_dump "$@"
(28-28/52)