forked from 0k/0k-charms
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.
44 lines
1.1 KiB
44 lines
1.1 KiB
#!/bin/bash
|
|
|
|
## Init is run on host
|
|
## For now it is run every time the script is launched, but
|
|
## it should be launched only once after build.
|
|
|
|
## Accessible variables are:
|
|
## - SERVICE_NAME Name of current service
|
|
## - DOCKER_BASE_IMAGE Base image from which this service might be built if any
|
|
## - SERVICE_DATASTORE Location on host of the DATASTORE of this service
|
|
## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
|
|
|
|
|
|
# Please note that postgres detect on its own if its datadir needs to be populated
|
|
|
|
. lib/common
|
|
|
|
|
|
ensure_db_docker_running
|
|
errlvl=$?
|
|
if [[ "$errlvl" == 18 ]]; then
|
|
err "Db connection seems not setup. Setting up."
|
|
_set_up_connection || exit 1
|
|
ensure_db_docker_running || {
|
|
die "Setup connection didn't work as expected."
|
|
}
|
|
fi
|
|
|
|
##
|
|
## checking permission of base directory
|
|
##
|
|
|
|
mkdir -p "$SERVICE_DATASTORE/var/lib/postgresql/data"
|
|
find "$SERVICE_DATASTORE/var/lib/postgresql/data" \! -perm 700 -exec chmod -v 700 {} \;
|
|
|
|
|
|
##
|
|
## pgm
|
|
##
|
|
|
|
echo 'prefix_pg_local_command=" " ## otherwise, will default to sudo -u postgres ' > ~/.pgm.rc
|
|
|
|
info "New root password for postgres. "
|
|
|