-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplupdate_checker.sh
More file actions
77 lines (64 loc) · 1.65 KB
/
Copy pathplupdate_checker.sh
File metadata and controls
77 lines (64 loc) · 1.65 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/data/adb/iunlocker/bin/bash
source "/data/adb/iunlocker/share/Scripts/utilities.sh" || {
echo "Error while sourcing utilities script"
exit 1
}
PLUGIN_NAME=""
FIELD=""
PLUGINS_JURL="https://raw.githubusercontent.com/i-Taylo/iUnlockerGL/refs/heads/main/biscuits/plugins.json"
export MEMORY_SIGNAL_MAGIC='0xE5FE'
function spr() {
local message="$1"
local NO_IGNORE_ON_PRINT="004"
# silent | echo -e "[[$MEMORY_SIGNAL_MAGIC$NO_IGNORE_ON_PRINT]](\"$message\")"
}
function raise_error() {
local reason="$1"
local EXIT_FAILURE=1
# "Contain" the error message into the memory magic
echo -e "[[$MEMORY_SIGNAL_MAGIC]](\"$reason\")"
return $EXIT_FAILURE
}
for arg in "$@"; do
case $arg in
-plugin_name=*)
PLUGIN_NAME="${arg#*=}"
;;
-getVersion)
FIELD="version"
;;
-getVersionCode)
FIELD="versionCode"
;;
-getExecUrl)
FIELD="executableUrl"
;;
-getChangelog)
FIELD="changelog"
;;
*)
echo "Unknown argument: $arg"
exit 1
;;
esac
done
if [[ -z "$PLUGIN_NAME" || -z "$FIELD" ]]; then
echo "Usage: bash $0 -plugin_name=\"<plugin>\" -getVersion | -getVersionCode | -getExecUrl | -getChangelog"
exit 1
fi
JSON_FILE="$TEMPDIR/plugins.json"
if ! download "$JSON_FILE" "$PLUGINS_JURL"; then
raise_error "Failed to download plugins.json"
exit 1
fi
if [[ ! -f "$JSON_FILE" ]]; then
echo "Error: $JSON_FILE not found!"
exit 1
fi
# Use jq to extract the field value from the plugin
VALUE=$(jq -r ".[\"$PLUGIN_NAME\"][\"$FIELD\"] // empty" "$JSON_FILE")
if [[ -z "$VALUE" ]]; then
echo "Plugin '$PLUGIN_NAME' or field '$FIELD' not found"
exit 1
fi
echo "$VALUE"