-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.sh
More file actions
29 lines (23 loc) · 744 Bytes
/
verify.sh
File metadata and controls
29 lines (23 loc) · 744 Bytes
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
#!/system/bin/sh
UPDATE="/data/adb/modules_update/netblock"
HASHFILE="$UPDATE/hash"
# Check if hash file exists
if [ ! -f "$HASHFILE" ]; then
echo " ✦ Hash file not found: $HASHFILE"
exit 1
fi
while IFS='|' read -r RELPATH EXPECT_SHA256; do
FILE="$UPDATE/$RELPATH"
# Check if file exists
if [ ! -f "$FILE" ]; then
echo " ✦ File $FILE not found!"
exit 1
fi
# Compute the actual SHA256 of the file
ACTUAL_SHA256=$(sha256sum "$FILE" | awk '{print $1}')
# Compare the actual and expected hashes
if [ "$ACTUAL_SHA256" != "$EXPECT_SHA256" ]; then
echo " ✦ Hash mismatch for $FILE (Expected: $EXPECT_SHA256, Got: $ACTUAL_SHA256)"
exit 1
fi
done < "$HASHFILE"