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.
This commit is contained in:
@@ -150,11 +150,20 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -x /usr/share/dotnet/dotnet && ! -x "/home/${SWARM_USER}/.dotnet/dotnet" ]]; then
|
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)"
|
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
|
||||||
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 \
|
mkdir -p \
|
||||||
"${SWARM_ROOT}/Models" \
|
"${SWARM_ROOT}/Models" \
|
||||||
|
|||||||
Reference in New Issue
Block a user