-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgsi-tool.sh
More file actions
executable file
·104 lines (94 loc) · 2.38 KB
/
Copy pathgsi-tool.sh
File metadata and controls
executable file
·104 lines (94 loc) · 2.38 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
if ! command -v adb &> /dev/null || ! command -v fastboot &> /dev/null; then
echo "Error: ADB or Fastboot not found in PATH!"
exit 1
fi
check_files() {
if [ ! -f "vbmeta.img" ] || [ ! -f "system.img" ] || [ ! -f "recovery.img" ]; then
echo ""
echo "Error: Missing vbmeta.img, system.img, or recovery.img!"
sleep 3
return 1
fi
return 0
}
update_system() {
check_files || return
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot flash vbmeta vbmeta.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot reboot
echo "Flashed!"
exit 0
}
reset_system() {
check_files || return
fastboot erase userdata
fastboot erase metadata
fastboot delete-logical-partition product_b
fastboot delete-logical-partition product
fastboot delete-logical-partition product_a
fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot flash vbmeta vbmeta.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot erase userdata
fastboot erase metadata
fastboot reboot
echo "Flashed!"
exit 0
}
action_menu() {
while true; do
echo ""
echo "Choose the action to perform:"
echo " 1. Update System"
echo " 2. Reset and Flash"
echo " 3. Back to Start"
read -p "Input: " choice_action
case $choice_action in
1)
update_system
;;
2)
reset_system
;;
3)
break
;;
*)
;;
esac
done
}
while true; do
clear
echo "Welcome to GSI Flash Tool by FeDeveloper95 - https://github.com/FeDeveloper95"
echo ""
echo "Choose the current state of the device:"
echo " 1. Booted in Android"
echo " 2. Recovery"
echo " 3. Bootloader"
echo " 4. Fastboot"
echo " 5. Quit"
read -p "Input: " choice_state
case $choice_state in
5)
exit 0
;;
4)
action_menu
;;
3)
fastboot reboot fastboot
action_menu
;;
2|1)
adb reboot fastboot
action_menu
;;
*)
;;
esac
done