Wrap all scripts in check

This commit is contained in:
Luke Murphy 2020-03-12 18:03:10 +01:00
parent 31684dd77e
commit bf75a7b7ee
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -5,10 +5,8 @@ set -eu -o pipefail
setup_db() { setup_db() {
set -eu set -eu
if [ -f "/data/gitea/conf/app.ini" ]; then echo "====> Running database migration"
echo "====> Running database migration" gitea migrate
gitea migrate
fi
} }
setup_root_user() { setup_root_user() {
@ -18,8 +16,6 @@ setup_root_user() {
if [[ "${user_count}" == "0" ]]; then if [[ "${user_count}" == "0" ]]; then
echo "====> Setting up root user for first run" echo "====> Setting up root user for first run"
if gitea admin create-user --username "$ADMIN_USER" --password "$ADMIN_PASS" --email "$ADMIN_MAIL" --admin; then if gitea admin create-user --username "$ADMIN_USER" --password "$ADMIN_PASS" --email "$ADMIN_MAIL" --admin; then
echo "====> root user added" echo "====> root user added"
else else
@ -32,8 +28,10 @@ setup_root_user() {
main() { main() {
set -eu set -eu
setup_db if [ -f "/data/gitea/conf/app.ini" ]; then
setup_root_user setup_db
setup_root_user
fi
} }
main main