view deploy/provision.d/080-database-load.sh @ 1625:808a40a7cac7 live

Have a go at fixing #570 Can't delete downloadable file from version in project with no issue tracker
author Chris Cannam
date Thu, 07 Feb 2019 13:48:00 +0000
parents 89d3095ddc70
children
line wrap: on
line source
#!/bin/bash

set -e

# Start the database and if a dump file is found, load it. The dump
# file is then deleted so that the db won't be overwritten on
# subsequent runs. (The original repo contains no dump file, so it
# should exist only if you have provided some data to load.)

/etc/init.d/postgresql start

dumpdir="/code-to-deploy"
if [ ! -d "$dumpdir" ]; then
    dumpdir=/var/www/code
fi

cd "$dumpdir"

if [ -f postgres-dumpall ]; then
    chmod ugo+r postgres-dumpall
    sudo -u postgres psql -f postgres-dumpall postgres
    rm postgres-dumpall
fi