microsoft/hve-core

Public

mirrored from https://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
feat/devcontainer-python-uv-887

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/skills/installer/hve-core-installer/scripts/eject.sh

26lines · modecode

1#!/usr/bin/env bash
2# Copyright (c) Microsoft Corporation.
3# SPDX-License-Identifier: MIT
4# Ejects a tracked file from HVE-Core upgrade management.
5# Marks the file as 'ejected' in .hve-tracking.json so future upgrades skip it.
6# Usage: eject.sh <file_path>
7set -euo pipefail
8
9file_path="${1:?Usage: $0 <file_path>}"
10manifest_path=".hve-tracking.json"
11
12if [ ! -f "$manifest_path" ]; then
13 echo "❌ No .hve-tracking.json found" >&2
14 exit 1
15fi
16
17if jq -e --arg fp "$file_path" '.files[$fp]' "$manifest_path" >/dev/null 2>&1; then
18 ejected_at=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
19 jq --arg fp "$file_path" --arg ea "$ejected_at" \
20 '.files[$fp].status = "ejected" | .files[$fp].ejectedAt = $ea' \
21 "$manifest_path" > "${manifest_path}.tmp" && mv "${manifest_path}.tmp" "$manifest_path"
22 echo "✅ Ejected: $file_path"
23 echo " This file will never be updated by HVE-Core."
24else
25 echo "❌ File not found in tracking manifest: $file_path"
26fi
27