From 356e08fda62608a33a2d442a28ce1443b97fd530 Mon Sep 17 00:00:00 2001 From: linushuan Date: Sat, 26 Sep 2026 21:18:11 +0800 Subject: [PATCH 1/2] Fix(fix/Default_pro): fix install first pro script Because the script will run install HelloTOJ each launch time, I fix it that now might just have install HelloTOJ once. --- scripts/runserver.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/runserver.sh b/scripts/runserver.sh index 27f1fbadc..58dd2c0b5 100755 --- a/scripts/runserver.sh +++ b/scripts/runserver.sh @@ -4,7 +4,10 @@ until pg_isready -h ${DB_CONTAINER_NAME} -p 5432; do done should_install_first_problem=false -if [[ -f docker-dev || -f docker-release ]] && [ -d static-tmp ]; then +PROBLEM_COUNT=$(PGPASSWORD=ntoj psql -h ${DB_CONTAINER_NAME} -U ntoj -d ntoj -tAc "SELECT count(*) FROM problem" 2>/dev/null || echo "0") +PROB_COUNT=$(echo "$PROB_COUNT" | xargs) + +if [[ -f docker-dev || -f docker-release ]] && [ -d static-tmp ] && [ "$PROBLEM_COUNT" -eq 0 ]; then should_install_first_problem=true ./scripts/docker-init.sh fi From 3dfbcf1cac0ae21618065e598f601889da0fc96e Mon Sep 17 00:00:00 2001 From: linushuan <126330400+linushuan@users.noreply.github.com> Date: Sat, 26 Sep 2026 22:00:17 +0800 Subject: [PATCH 2/2] Update database password retrieval in runserver.sh Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- scripts/runserver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runserver.sh b/scripts/runserver.sh index 58dd2c0b5..47258f562 100755 --- a/scripts/runserver.sh +++ b/scripts/runserver.sh @@ -4,7 +4,7 @@ until pg_isready -h ${DB_CONTAINER_NAME} -p 5432; do done should_install_first_problem=false -PROBLEM_COUNT=$(PGPASSWORD=ntoj psql -h ${DB_CONTAINER_NAME} -U ntoj -d ntoj -tAc "SELECT count(*) FROM problem" 2>/dev/null || echo "0") +PROBLEM_COUNT=$(PGPASSWORD="$(sed -n 's/^DB_PASSWORD=//p' scripts/.docker-init.env)" psql -h "${DB_CONTAINER_NAME}" -U ntoj -d ntoj -tAc "SELECT count(*) FROM problem" 2>/dev/null || echo "0") PROB_COUNT=$(echo "$PROB_COUNT" | xargs) if [[ -f docker-dev || -f docker-release ]] && [ -d static-tmp ] && [ "$PROBLEM_COUNT" -eq 0 ]; then