#!/usr/bin/with-contenv bash
# shellcheck shell=bash

# Disable php-fpm service as Mastodon doesn't use it
touch /etc/services.d/php-fpm/down

mkdir -p \
    /app/www/tmp \
    /config/mastodon/public/system

chown -R abc:abc \
    /app/www/tmp

ln -s /config/mastodon/public/system /app/www/public/system

cd /app/www/ || exit 1

s6-setuidgid abc /usr/bin/bundle exec rails db:prepare

chown abc:abc \
    /config/mastodon/public/system