File size: 1,425 Bytes
b88c26d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# BURT-IMMA Clone Integrity Verification
# Verifies that a clone matches the official release.
# Contact: jessica@collectivekitty.com

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
SOVEREIGN_DIR="$REPO_ROOT/sovereign"

echo "========================================"
echo "BURT-IMMA CLONE INTEGRITY VERIFICATION"
echo "========================================"
echo ""

if [ ! -f "$SOVEREIGN_DIR/release.json" ]; then
  echo "ERROR: sovereign/release.json not found"
  exit 1
fi

echo "[1] Reading release metadata..."
RELEASE_FILE="$SOVEREIGN_DIR/release.json"
GIT_COMMIT=$(grep '"git_commit"' "$RELEASE_FILE" | head -1 | cut -d'"' -f4)
VERSION=$(grep '"release_version"' "$RELEASE_FILE" | head -1 | cut -d'"' -f4)

echo "    Version: $VERSION"
echo ""

echo "[2] Verifying git commit..."
CURRENT_COMMIT=$(cd "$REPO_ROOT" && git rev-parse HEAD 2>/dev/null || echo "")

if [ -z "$CURRENT_COMMIT" ]; then
  echo "    Not a git repository"
  exit 2
fi

if [ "$CURRENT_COMMIT" != "$GIT_COMMIT" ]; then
  echo "    Commit mismatch"
  echo "    Expected: $GIT_COMMIT"
  echo "    Actual:   $CURRENT_COMMIT"
  exit 1
fi

echo "    Commit matches release"
echo ""
echo "========================================"
echo "STATUS: INTEGRITY_VERIFIED"
echo "========================================"
echo ""

exit 0