1.7 KiB
Standalone usage
When invoked directly as /gstack-upgrade (not from a preamble):
- Force a fresh update check (bypass cache):
${GSTACK_OPENCODE_DIR}/bin/gstack-update-check --force 2>/dev/null || \
${GSTACK_OPENCODE_DIR}/bin/gstack-update-check --force 2>/dev/null || true
Use the output to determine if an upgrade is available.
-
If
UPGRADE_AVAILABLE <old> <new>: follow Steps 2-6 above. -
If no output (primary is up to date): check for a stale local vendored copy.
Run the Step 2 bash block above to detect the primary install type and directory (INSTALL_TYPE and INSTALL_DIR). Then run the Step 4.5 detection bash block above to check for a local vendored copy (LOCAL_GSTACK).
If LOCAL_GSTACK is empty (no local vendored copy): tell the user "You're already on the latest version (v{version})."
If LOCAL_GSTACK is non-empty, compare versions:
PRIMARY_VER=$(cat "$INSTALL_DIR/VERSION" 2>/dev/null || echo "unknown")
LOCAL_VER=$(cat "$LOCAL_GSTACK/VERSION" 2>/dev/null || echo "unknown")
echo "PRIMARY=$PRIMARY_VER LOCAL=$LOCAL_VER"
If versions differ: follow the Step 4.5 sync bash block above to update the local copy from the primary. Tell user: "Global v{PRIMARY_VER} is up to date. Updated local vendored copy from v{LOCAL_VER} → v{PRIMARY_VER}. Commit ${GSTACK_OPENCODE_DIR}/ when you're ready."
If versions match: tell the user "You're on the latest version (v{PRIMARY_VER}). Global and local vendored copy are both up to date."