Commit 30cb22ce authored by Gilles Quenot's avatar Gilles Quenot

add sudo for all psql commands

parent 2cb18aae
Pipeline #1187 passed with stage
in 11 minutes and 26 seconds
......@@ -42,12 +42,12 @@ pip install -e .[testing]
src/memopol/bin/install_client_deps.sh
# Create pg user and database
if [ $(psql -c "select 'CNT=' || count(1) from pg_catalog.pg_user where usename='memopol';" -U postgres | grep CNT=1 | wc -l) -lt 1 ]; then
psql -c "create user memopol with password 'memopol';" -U postgres
if [ $(sudo -u postgres psql -c "select 'CNT=' || count(1) from pg_catalog.pg_user where usename='memopol';" -U postgres | grep CNT=1 | wc -l) -lt 1 ]; then
sudo -u postgres psql -c "create user memopol with password 'memopol';" -U postgres
fi
psql -c "alter role memopol with createdb;" -U postgres
if [ $(psql -l -U postgres | egrep "^ memopol\W" | wc -l) -lt 1 ]; then
psql -c "create database memopol with owner memopol;" -U postgres
sudo -u postgres psql -c "alter role memopol with createdb;" -U postgres
if [ $(sudo -u postgres psql -l -U postgres | egrep "^ memopol\W" | wc -l) -lt 1 ]; then
sudo -u postgres psql -c "create database memopol with owner memopol;" -U postgres
fi
# Setup environment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment