-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmenu
More file actions
executable file
·223 lines (185 loc) · 4.3 KB
/
menu
File metadata and controls
executable file
·223 lines (185 loc) · 4.3 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#!/bin/bash
############################################################################
#
# Copyright (c) 2013 - dsixda (dislam@rocketmail.com)
#
# Android Kitchen is 100% free. This script file is intended for personal
# and/or educational use only. It may not be duplicated for monetary
# benefit or any other purpose without the permission of the developer.
#
############################################################################
version=0.003
if [ ! -e menu ]
then
echo
echo "Ensure you run this file from the SAME folder as where it was"
echo "installed, otherwise the kitchen will have problems running the"
echo "scripts. After you 'cd' to the correct folder, start the kitchen"
echo "with the ./menu command, NOT with any other command or method!"
exit 0
fi
dir_list=( scripts tools )
error_found=0
for check_dir in ${dir_list[@]}
do
if [ ! -e $check_dir ]
then
echo "Error: Folder '$check_dir' not found"
error_found=1
fi
done
if [ $error_found == 1 ]
then
echo
echo "Ensure you have installed the folders for the kitchen correctly."
exit 0
fi
chmod 755 scripts/*
scripts/check_install_dir
if [ "$?" == "1" ]
then
exit 0
fi
scripts/init_kitchen
scripts/check_binaries
if [ "$?" == "1" ]
then
exit 0
fi
if [ ! -e WORKING_* ]
then
mkdir WORKING_BOOTIMG
./menu
fi
while :
do
clear
echo
echo
echo "Lopicl's Kernel Kitchen"
echo "Based on Dsixda's Android Kitchen!"
echo "Version $version"
echo
echo "----------------"
echo
echo "Put a boot.img in the WORKING folder to unlock hidden functions!"
echo "Enter a choice:"
echo
if [ -d WORKING_* ]
then
if [ -d BOOT-EXTRACTED ]
then
extracted=true
else
extracted=false
fi
cd WORKING_*
if [ -e boot.img ]
then
boot_img=true
else
boot_img=false
fi
if [ -d boot ]
then
boot_folder=true
else
boot_folder=false
fi
cd ..
if [ "$boot_img" == "true" ]
then
echo " s = Show boot.img information"
fi
if [ "$extracted" == "true" ]
then
echo " b = Build boot.img from BOOT-EXTRACTED folder (for working folder)"
echo " n = Build NAND's boot folder from BOOT-EXTRACTED (for working folder)"
echo " r = Remove BOOT-EXTRACTED folder (don't build anything)"
elif [ "$boot_img" == "true" ]
then
echo " w = Extract kernel+ramdisk from boot.img"
echo " c = Convert boot.img into NAND boot folder"
echo " p = Change 'command line' parameter in boot.img"
elif [ "$boot_folder" == "true" ]
then
echo " y = Convert NAND boot folder into boot.img"
echo " z = Extract kernel+ramdisk from NAND boot folder"
fi
fi
echo " a = Extract kernel+ramdisk from boot.img/recovery.img in any folder"
echo " k = Restart Kitchen to refresh functions "
echo
echo " NOTE: Other options may not be shown in this menu *until* a specific"
echo " action above is selected or a specific working folder is created."
echo " (A working folder is created automatically at first time kitchen boots up!)"
echo
echo -n "? "
read enterLetter
key=$enterLetter
if [ "$boot_img" == "true" ]
then
if [ "$key" == "s" ]
then
scripts/show_boot_img_info
else :
fi
else :
fi
if [ "$extracted" == "true" ]
then
if [ "$key" == "b" ]
then
scripts/prompt_build_bootimg
elif [ "$key" == "n" ]
then
scripts/prompt_build_boot
scripts/build_nand_boot
elif [ "$key" == "r" ]
then
rm -rf BOOT-EXTRACTED; echo; echo "Deleted"
else :
fi
else :
fi
if [ "$boot_img" == "true" ]
then
if [ "$key" == "w" ]
then
scripts/ensure_boot_extracted
elif [ "$key" == "c" ]
then
scripts/ensure_boot_extracted
scripts/build_nand_boot
elif [ "$key" == "p" ]
then
scripts/change_cmdline
else :
fi
else :
fi
if [ "$boot_folder" == "true" ]
then
if [ "$key" == "y" ]
then
scripts/ensure_nand_extracted
scripts/build_boot_img
elif [ "$key" == "z" ]
then
scripts/ensure_nand_extracted
else :
fi
else :
fi
if [ "$key" == "a" ]
then
scripts/extract_boot_img
elif [ "$key" == "k" ]
then
bash ./menu
else
scripts/press_enter
bash ./menu
fi
scripts/press_enter
done