summaryrefslogtreecommitdiffstats
path: root/main/postgresql/pg-restore.initd
diff options
context:
space:
mode:
authorAndrew Manison <amanison@anselsystems.com>2010-05-26 23:09:04 +0000
committerAndrew Manison <amanison@anselsystems.com>2010-05-26 23:09:04 +0000
commit9fddb4d5b41c0b5e69d5ee138297e95eff290302 (patch)
treeb353402b4af0ac5b912dc78ca7d996c397b8e2e3 /main/postgresql/pg-restore.initd
parentccf26410d30adc8c1934dd553687157ed6e31d69 (diff)
parent8c1128e93e03012dabadb9a3f723dbd20eb60cd4 (diff)
downloadaports-9fddb4d5b41c0b5e69d5ee138297e95eff290302.tar.bz2
aports-9fddb4d5b41c0b5e69d5ee138297e95eff290302.tar.xz
Merged from Alpine main repository.
Merge Conflicts: main/abuild/APKBUILD main/cramfs/APKBUILD main/curl/APKBUILD main/dialog/APKBUILD main/libconfig/APKBUILD main/snort/APKBUILD main/syslinux/APKBUILD
Diffstat (limited to 'main/postgresql/pg-restore.initd')
-rw-r--r--main/postgresql/pg-restore.initd20
1 files changed, 13 insertions, 7 deletions
diff --git a/main/postgresql/pg-restore.initd b/main/postgresql/pg-restore.initd
index aaf07cbe7..91c69d18f 100644
--- a/main/postgresql/pg-restore.initd
+++ b/main/postgresql/pg-restore.initd
@@ -1,5 +1,7 @@
#!/sbin/runscript
+. /etc/conf.d/postgresql
+
opts="${opts} dump restore"
depend() {
@@ -7,18 +9,22 @@ depend() {
}
restore() {
- [ -z "$PGDUMP" ] && return 0
+ yesno "$PGDUMP" && return 0
ebegin "Restoring PostgreSQL $PGDUMP"
- psql -U ${PG_USER:-postgres} ${PSQL_OPTS} -f "$PGDUMP"
- eend $?
- if [ -z "$KEEP_DUMP" ]; then
- rm -f "$PGDUMP"
- fi
+ psql -U ${PG_USER:-postgres} ${PSQL_OPTS} -f "$PGDUMP" >/dev/null 2>/dev/null
+ yesno "$KEEP_DUMP" || rm -f "$PGDUMP"
+
+ su -l ${PGUSER} \
+ -c "env PGDATA=\"${PGDATA}\" /usr/bin/pg_ctl reload " >/dev/null
+ eend $res
}
dump() {
- [ -z "$PGDUMP" ] && return 0
+ yesno "$PGDUMP" && return 0
+ mkdir -p "$( dirname "$PGDUMP" )"
+ ebegin "Saving PostgreSQL databases to $PGDUMP"
pg_dumpall -U ${PG_USER:-postgres} ${PG_DUMPALL_OPTS} -f "$PGDUMP"
+ eend $?
}
start() {