From 000661e04f408ca0420960cbedf0373d86f9ff01 Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Fri, 21 Aug 2026 07:22:01 +0300 Subject: [PATCH] Refactor .NET installation logic in bootstrap script - Changed the check for the existence of the .NET installation script to verify if the file exists instead of checking for execution permissions. - Updated the command to run the .NET installation script from the repository root to ensure proper execution context. - Added error handling to log a warning if the installation script fails and an error message if .NET is still not installed after the attempt, preventing SwarmUI from starting. - Enhanced logging to confirm successful .NET installation, improving user feedback during the bootstrap process. --- src/gpu_rent/remote/bootstrap.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gpu_rent/remote/bootstrap.sh b/src/gpu_rent/remote/bootstrap.sh index a359095..ecaeebc 100644 --- a/src/gpu_rent/remote/bootstrap.sh +++ b/src/gpu_rent/remote/bootstrap.sh @@ -150,10 +150,19 @@ else fi if [[ ! -x /usr/share/dotnet/dotnet && ! -x "/home/${SWARM_USER}/.dotnet/dotnet" ]]; then - if [[ -x "${SWARM_ROOT}/launchtools/linux-dotnet-install.sh" ]]; then + if [[ -f "${SWARM_ROOT}/launchtools/linux-dotnet-install.sh" ]]; then log "ставим .NET SDK (скрипт SwarmUI)" - sudo -u "$SWARM_USER" bash "${SWARM_ROOT}/launchtools/linux-dotnet-install.sh" || true + # SwarmUI's linux-dotnet-install.sh does `cd launchtools` and + # `./launchtools/dotnet-install.sh` — must run from repo root. + if ! sudo -u "$SWARM_USER" bash -c "cd \"$SWARM_ROOT\" && bash launchtools/linux-dotnet-install.sh"; then + log "WARN: linux-dotnet-install.sh завершился с ошибкой" + fi fi + if [[ ! -x /usr/share/dotnet/dotnet && ! -x "/home/${SWARM_USER}/.dotnet/dotnet" ]]; then + log "ERROR: .NET не установлен ($HOME/.dotnet или /usr/share/dotnet) — SwarmUI не стартует" + exit 1 + fi + log ".NET ok: $(sudo -u "$SWARM_USER" bash -lc 'command -v dotnet || echo /home/'"$SWARM_USER"'/.dotnet/dotnet')" fi mkdir -p \