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.
container-overlay/profiles/templates/taiga/taiga/sh.setup-postgresql

47 lines
1.1 KiB

# Calculate path=/var/calculate/bin name=#-cut(1,.)-# chmod=755 comment=#
#!/bin/bash
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
all=
while IFS= read -r line
do
if [[ $line == *"["* ]]
then
line=${line#*[}
line=${line%%]*}
sec=$line
continue
fi
com=${sec}_${line// =/=};
com=${com//= /=};
all="$com; $all"
done < /var/calculate/ini.env
eval $all
ebegin 'Проверка выполненной базовой настройки'
if [[ ! -e /var/lib/postgresql/12 ]]
then
echo Выполните настройку 'emerge --config =dev-db/postgresql-12.12'.
exit 1
fi
eend
ebegin 'Проверка запущенного PostgreSQL'
if [[ $(ls /run/postgresql/.*lock 2>/dev/null | wc -l) == 0 ]]
then
echo Запустите PostgreSQL
exit 1
fi
eend
ebegin 'Проверка наличия роли taiga'
$(psql -U taiga -d taiga -c '\dt' 2&>/dev/null) || {
echo Пароль: $taiga_pgsql_password
createuser -U postgres -P taiga
createdb -U postgres -O taiga taiga
}
eend
cl-core-setup -n postgresql