-
Notifications
You must be signed in to change notification settings - Fork 2
/
start.sh
executable file
·82 lines (73 loc) · 1.45 KB
/
start.sh
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
#!/bin/bash
# tab width
tabs 4
clear
#----- Import Functions -----#
dir="$(dirname "$0")"
. $dir/functions/backup
. $dir/functions/bootloader
. $dir/functions/check
. $dir/functions/erase
. $dir/functions/images
. $dir/functions/recovery
. $dir/functions/root
. $dir/functions/search
. $dir/functions/tools
#----- Fancy Messages -----#
show_error(){
echo -e "\033[1;31m$@\033[m" 1>&2
}
show_info(){
echo -e "\033[1;32m$@\033[0m"
}
show_warning(){
echo -e "\033[1;33m$@\033[0m"
}
show_question(){
echo -e "\033[1;34m$@\033[0m"
}
show_success(){
echo -e "\033[1;35m$@\033[0m"
}
show_header(){
echo -e "\033[1;36m$@\033[0m"
}
show_listitem(){
echo -e "\033[0;37m$@\033[0m"
}
# Main
function main {
eval `resize`
MAIN=$(whiptail \
--notags \
--title "Nexus Toolkit" \
--menu "\nWhat would you like to do?" \
--ok-button "Run" \
--cancel-button "Quit" \
$LINES $COLUMNS $(( $LINES - 12 )) \
search 'Search devices' \
backup 'Backup/Restore' \
bootloader 'OEM Lock/Unlock' \
erase 'Erase sections' \
images 'Install Factory Images for Nexus and Pixel Devices' \
recovery 'Install TWRP recovery' \
root 'Install Super SU' \
tools 'Other tools' \
3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
clear && $MAIN
else
clear && quit
fi
}
# Quit
function quit {
if (whiptail --title "Quit" --yesno "Are you sure you want quit?" 10 60) then
exit 99
else
clear && main
fi
}
# Run
check && main