-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathriverbraid
More file actions
43 lines (39 loc) · 1.21 KB
/
riverbraid
File metadata and controls
43 lines (39 loc) · 1.21 KB
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
#!/bin/bash
# Riverbraid-Core Verifier (Hardened)
MANIFEST="manifest.json"
case "$1" in
init)
echo "Initializing Riverbraid-Core..."
touch "$MANIFEST"
echo "Done."
;;
snapshot)
echo "Recording file states..."
# Exclude manifest itself and hidden git files
find . -maxdepth 1 -type f ! -name "$MANIFEST" ! -name ".*" -exec sha256sum {} + > "$MANIFEST"
echo "Done: Snapshot recorded in $MANIFEST."
;;
verify)
echo "Verifying integrity..."
if [ ! -f "$MANIFEST" ]; then
echo "ERROR: No manifest found. Run snapshot first."
exit 1
fi
# Create a stable verification state
find . -maxdepth 1 -type f ! -name "$MANIFEST" ! -name ".*" -exec sha256sum {} + > ".verify.tmp"
if diff "$MANIFEST" ".verify.tmp" > /dev/null; then
echo "Integrity Verified."
rm ".verify.tmp"
exit 0
else
echo "FAIL: File state has changed."
diff "$MANIFEST" ".verify.tmp"
rm ".verify.tmp"
exit 1
fi
;;
*)
echo "Usage: $0 {init|snapshot|verify}"
exit 1
;;
esac