You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#!/bin/bash ## compose: no-hooks
if [ -z "$SERVICE_DATASTORE" ]; then echo "This script is meant to be run through 'compose' to work properly." >&2 exit 1 fi
version=0.1 usage="$exname [-h|--help] [--force|-f] [DBNAME]" help=" USAGE:
$usage
DESCRIPTION:
Read stdin and send it to the restore API of odoo service to restore in the database DBNAME. If DBNAME is not provided, it'll take the default odoo database from the ${DARKCYAN}postgres-database${NORMAL} relation of current service.
EXAMPLES:
$exname < dump.zip $exname odoo2 < odoo2.zip
"
dbname= neutralize= while [ "$1" ]; do case "$1" in "--help"|"-h") print_help >&2 exit 0 ;; "--neutralize"|"-n") neutralize=yes ;; "--force"|"-f") force=yes ;; --*|-*) err "Unexpected optional argument '$1'" print_usage >&2 exit 1 ;; *) [ -z "$dbname" ] && { dbname=$1 ; shift ; continue ; } err "Unexpected positional argument '$1'" print_usage >&2 exit 1 ;; esac shift done
version:ge() { [ "$(printf '%s\n' "$@" | sort -rV | head -n 1)" == "$1" ]; } version:lt() { ! version:ge "$@"; }
if [ -z "$dbname" ]; then dbname=$(relation:get "$SERVICE_NAME:postgres-database" dbname) || { err "Couldn't retrieve information of" \ "${DARKYELLOW}$SERVICE_NAME${NORMAL}-->${DARKCYAN}postgres-database${NORMAL}." exit 1 } fi
. "$CHARM_PATH/lib/common"
set -e
odoo:load "$dbname" "$neutralize"
|