-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchooseProfile.sh
More file actions
executable file
·44 lines (35 loc) · 1.18 KB
/
chooseProfile.sh
File metadata and controls
executable file
·44 lines (35 loc) · 1.18 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
#!/bin/zsh
source ./utils.sh
app_bundle_name=$(grep '^appBundleName:' "settings.conf" | cut -d':' -f2 | xargs)
profiles_path="/sdcard/Android/data/$app_bundle_name/files/profiles"
device="$1"
clear
echo
if ! adb -s "$device" shell "[ -d $profiles_path ]"; then
echo "❌ Error: Folder $profiles_path does not exist."
exit 11
fi
files=()
while IFS= read -r line; do
[[ -n "$line" ]] && files+=("$line")
done < <(adb -s "$device" shell "ls -1 $profiles_path | grep '.json$'")
if [[ ${#files} -eq 0 ]]; then
echo "❌ Error: No .json files found in $profiles_path"
exit 12
fi
bold_text "$(reverse_text "Select a profile from the list below to read")"
for i in {1..$#files}; do
echo " [$i] $files[i]"
done
echo -n "📝 Enter the number of the profile from the list above: "
read profile_number
if [[ "$profile_number" =~ '^[0-9]+$' ]] && ((profile_number >= 1 && profile_number <= $#files)); then
selected_file="$files[profile_number]"
echo "📁 Selected file: $selected_file"
./readProfile.sh "$device" "$selected_file" "$profiles_path"
else
echo
echo "❌ Error: Invalid profile number entered."
wait_for_any_key
./chooseProfile.sh "$device"
fi