Add support for gpu-rent.vars and enhance git update functionality
- Updated .gitignore to include gpu-rent.vars. - Modified env.example to introduce the UPDATE_GIT variable for controlling git updates during execution. - Implemented Import-GpuRentVars function in gpu-rent.ps1 to load environment variables from gpu-rent.vars. - Enhanced gpu-rent.sh to support loading variables from gpu-rent.vars and added logic for handling default and extra arguments. - Updated CLI documentation to reflect the new gpu-rent.vars file and its usage in configuration. - Improved bootstrap and provisioning logic to conditionally perform git updates based on the new configuration.
This commit is contained in:
@@ -97,8 +97,21 @@ if [[ ! -d "${SWARM_ROOT}/.git" ]]; then
|
||||
log "clone SwarmUI -> ${SWARM_ROOT}"
|
||||
mkdir -p "$(dirname "$SWARM_ROOT")"
|
||||
git clone --depth 1 "$SWARM_REPO" "$SWARM_ROOT"
|
||||
elif [[ "${GPU_RENT_UPDATE_GIT:-1}" == "1" ]]; then
|
||||
log "обновляю SwarmUI в ${SWARM_ROOT}"
|
||||
branch="$(git -C "$SWARM_ROOT" remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || true)"
|
||||
branch="${branch:-master}"
|
||||
# shallow clone: deepen tip of default branch
|
||||
git -C "$SWARM_ROOT" fetch --depth 1 origin "$branch" || git -C "$SWARM_ROOT" fetch --depth 1 origin
|
||||
if git -C "$SWARM_ROOT" rev-parse --verify -q "origin/${branch}" >/dev/null; then
|
||||
git -C "$SWARM_ROOT" checkout -B "$branch" "origin/${branch}"
|
||||
git -C "$SWARM_ROOT" reset --hard "origin/${branch}"
|
||||
else
|
||||
git -C "$SWARM_ROOT" pull --ff-only || true
|
||||
fi
|
||||
log "SwarmUI @ $(git -C "$SWARM_ROOT" rev-parse --short HEAD)"
|
||||
else
|
||||
log "SwarmUI уже в ${SWARM_ROOT}"
|
||||
log "SwarmUI уже в ${SWARM_ROOT} (update off)"
|
||||
fi
|
||||
|
||||
if [[ ! -x /usr/share/dotnet/dotnet && ! -x "/home/${SWARM_USER}/.dotnet/dotnet" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user