2023-04-29 01:32:09 +08:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure|upgrade|1|2)
|
|
|
|
|
|
|
|
fc-cache -f
|
|
|
|
|
2023-05-11 04:07:44 +08:00
|
|
|
sudo -u postgres psql -c "alter user postgres password 'bbb_graphql'"
|
|
|
|
sudo -u postgres psql -c "drop database if exists bbb_graphql"
|
|
|
|
sudo -u postgres psql -c "create database bbb_graphql"
|
2023-05-11 04:26:42 +08:00
|
|
|
sudo -u postgres psql -U postgres -d bbb_graphql -a -f /etc/default/bbb-graphql-server/bbb_schema.sql --set ON_ERROR_STOP=on
|
2023-05-11 04:07:44 +08:00
|
|
|
sudo -u postgres psql -c "drop database if exists hasura_app"
|
|
|
|
|
2023-04-29 01:32:09 +08:00
|
|
|
sudo -u postgres psql -c "create database hasura_app"
|
|
|
|
echo "Postgresql configured"
|
|
|
|
|
|
|
|
# Apply BBB metadata in Hasura
|
2023-05-11 04:41:18 +08:00
|
|
|
/usr/local/bin/hasura/hasura /etc/default/bbb-graphql-server/metadata apply
|
2023-04-29 02:36:38 +08:00
|
|
|
rm -rf /etc/default/bbb-graphql-server/metadata
|
2023-04-29 01:32:09 +08:00
|
|
|
|
|
|
|
systemctl enable bbb-graphql-server.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
startService bbb-graphql-server || echo "bbb-graphql-server service could not be registered or started"
|
|
|
|
;;
|
|
|
|
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|