7 echo " ./builder <command> [-d|--dryrun] [-a|--allfiles] [-s|--short] ..."
8 echo " ./builder <-h|--help|help>"
18 echo " dump [dumpfile]"
19 echo " dumpall [dumpfile]"
28 if [ "$SHORT" = "y" ]; then
29 sed "s/#PFX#/$PFX/g" | psql -a $pg_args 2>&1 | egrep 'ERROR|^-- MESG'
31 sed "s/#PFX#/$PFX/g" | psql -a $pg_args
38 if [ "$ALL_FILES" = "y" ]; then
44 if [ "$1" = "" ]; then
58 while [ $# -gt 0 ]; do
63 echo "MOCKPSQL params: $@"
80 if [ -f $HOME/.brisk-db.conf ]; then
81 source $HOME/.brisk-db.conf
82 elif [ -f $HOME/.db.conf ]; then
93 if [ -f $HOME/.brisk_install ]; then
94 source $HOME/.brisk_install
98 test "$DBHOST" != "" && pg_args="$pg_args -h $DBHOST"
99 test "$DBUSER" != "" && pg_args="$pg_args -U $DBUSER"
100 test "$DBPORT" != "" && pg_args="$pg_args -p $DBPORT"
101 test "$DBBASE" != "" && pg_args="$pg_args $DBBASE"
103 MATCH_DROP='^drop|^alter table.* drop '
108 su root -c "su postgres -c \"echo \\\"DBUser passwd: $DBPASS\\\" ; createuser -S -D -R -P $DBUSER && createdb -E utf8 -O $DBUSER $DBBASE\""
113 su root -c "su postgres -c \"dropdb $DBBASE && dropuser $DBUSER\""
116 ( echo "-- MESG: clean start" ; one_or_all $2 | egrep -i "$MATCH_DROP" | tac ; echo "-- MESG: clean end" ; ) | sqlexe
119 ( echo "-- MESG: build start" ; one_or_all $2 | egrep -iv "$MATCH_DROP" ; echo "-- MESG: build end" ; ) | sqlexe
122 ( echo "-- MESG: clean start" ; one_or_all $2 | egrep -i "$MATCH_DROP" | tac ; echo "-- MESG: clean end" ; \
123 echo "-- MESG: build start" ; one_or_all $2 | egrep -iv "$MATCH_DROP" ; echo "-- MESG: build end" ; ) \
131 psql $pg_args -t -q -A -F '|' $@
134 if [ $# -eq 1 ]; then
135 pg_dump -a --inserts -h $DBHOST -U $DBUSER $DBBASE
137 pg_dump -a --inserts -h $DBHOST -U $DBUSER $DBBASE > $1
141 if [ $# -eq 1 ]; then
142 pg_dump -h $DBHOST -U $DBUSER $DBBASE
144 pg_dump -h $DBHOST -U $DBUSER $DBBASE > $1
150 "help"|"-h"|"--help")