29 lines
545 B
Bash
Executable File
29 lines
545 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
setup_root_user() {
|
|
set -eu
|
|
|
|
user_count=$(sqlite3 /data/gitea.db "SELECT count(*) FROM user;")
|
|
|
|
if [[ "${user_count}" == "0" ]]; then
|
|
echo "==> Setting up root user for first run"
|
|
|
|
if gitea admin create-user --username "$ADMIN_USER" --password "$ADMIN_PASS" --email "$ADMIN_MAIL" --admin; then
|
|
echo "==> root user added"
|
|
else
|
|
echo "==> Failed to add root user"
|
|
exit 1
|
|
fi
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
set -eu
|
|
|
|
setup_root_user
|
|
}
|
|
|
|
main
|