#!/bin/sh while ! mariadb -hmariadb -u$GITEA_DATABASE_USR -p$GITEA_DATABASE_PWD $GITEA_DATABASE_NAME &>/dev/null; do echo "Gitea waiting db..." sleep 30 done if [ ! -f "app.ini.bak" ]; then echo "Initializing gitea..." mv app.ini app.ini.bak cp /tmp/app.ini . sed -i "/NAME .*/c\NAME = $GITEA_DATABASE_NAME" app.ini sed -i "/USER .*/c\USER = $GITEA_DATABASE_USR" app.ini sed -i "/PASSWD .*/c\PASSWD = $GITEA_DATABASE_PWD" app.ini gitea migrate gitea admin user create --username $GITEA_ADMIN_USR --password $GITEA_ADMIN_PWD --email $GITEA_ADMIN_MAIL --admin fi echo "Launching gitea on localhost:3000" gitea web --config /etc/gitea/app.ini