Drop commands out onto lines

This commit is contained in:
Luke Murphy 2020-03-29 10:26:15 +02:00
parent 0a06ff5c74
commit d39ddd9a72
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -11,11 +11,27 @@ setup_root_user() {
return return
fi fi
user_count=$(mysql -u"${DB_USER}" -p"${DB_PASSWD}" -h "${DOKKU_MARIADB_GITEA_PORT_3306_TCP_ADDR}" --database="${DB_NAME}" -N -B -e "SELECT count(*) FROM user;") user_count=$(mysql \
-u"${DB_USER}" \
-p"${DB_PASSWD}" \
-h "${DOKKU_MARIADB_GITEA_PORT_3306_TCP_ADDR}" \
--database="${DB_NAME}" \
-N -B -e "SELECT count(*) FROM user;" \
)
if [[ "${user_count}" == "0" ]]; then if [[ "${user_count}" == "0" ]]; then
echo "-----> Setting up root user for initial deployment" echo "-----> Setting up root user for initial deployment"
if gitea admin create-user --username "$ADMIN_USER" --password "$ADMIN_PASS" --email "$ADMIN_MAIL" --admin; then
create_user=$(gitea \
admin \
create-user \
--username "$ADMIN_USER" \
--password "$ADMIN_PASS" \
--email "$ADMIN_MAIL" \
--admin \
)
if "$create_user"; then
echo "-----> root user added" echo "-----> root user added"
else else
echo "-----> Failed to add root user" echo "-----> Failed to add root user"