forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchoose_rom
More file actions
executable file
·216 lines (167 loc) · 4.68 KB
/
choose_rom
File metadata and controls
executable file
·216 lines (167 loc) · 4.68 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
############################################################################
#
# Copyright (c) 2013 - dsixda ([email protected])
#
# 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.
#
############################################################################
#
# This script has two optional arguments:
#
# $1 = "kernel_only" - dont't modify any files after extraction
# = "name_given" - if this is used, then $2 is mandatory
# $2 = ROM name under original_update (specify only if $1 = "name_given")
#
if [ "$1" == "name_given" ]
then
file_chosen=$2
if [ "$file_chosen" == "" ]
then
echo "Error: ROM name not specified!"
cd ..
exit 0
fi
if [ ! -e original_update/$file_chosen ]
then
echo "Error: original_update/$file_chosen not found!"
exit 0
fi
else
while [ 1==1 ]
do
echo
echo "Please wait ..."
echo
#
# This script will search original_update for available ROMs
#
grep_cmd=`scripts/grep_roms`
if [ "$grep_cmd" == "" ]
then
echo "Error: No ROMs found under original_update folder!"
exit 0
fi
count=0
rm -f temp.list
echo >> temp.list
echo "Available ROMs:" >> temp.list
echo >> temp.list
for filename in $grep_cmd
do
count=$(($count+1))
filename=`echo $filename | sed 's/temp_space/ /g'`
# Store file names in an array
file_array[$count]=$filename
if [ "$filename" == "system.img" ]
then
filename="system.img and boot.img"
elif [ "$filename" == "factoryfs.rfs" ]
then
filename="factoryfs.rfs, cache.rfs and zImage"
elif [ "$filename" == "system.rfs" ]
then
filename="system.rfs, csc.rfs and boot.img"
elif [ "$filename" == "system.img.ext4" ]
then
filename="system.img.ext4, tomb.img.ext4, cache.img.ext4 and boot.img"
elif [ "$filename" == "system.ext4.tar" ]
then
filename="system.ext4.tar and boot.img"
elif [ "$filename" == "factoryfs.img" ]
then
filename="factoryfs.img, hidden.img, cache.img and zImage"
elif [ "$filename" == "PDA.tar.md5" ]
then
filename="PDA.tar.md5, CSC.tar.md5 and PHONE.tar.md5"
elif [ "$filename" == "PDA.tar" ]
then
filename="PDA.tar, CSC.tar and PHONE.tar"
fi
echo " ($count) $filename" >> temp.list
done
more temp.list
rm -f temp.list
echo
echo -n "Enter selection number (default=1, cancel=0, r=refresh): "
read enterNumber
echo
if [ "$enterNumber" == "0" ]
then
exit 0
fi
if [ "$enterNumber" == "" ]
then
enterNumber=1
fi
if [ "$enterNumber" == "r" ]
then
continue
fi
if [ "`echo $enterNumber | sed 's/[0-9]*//'`" == "" ] || [ "enterNumber"=="1" ]
then
file_chosen=${file_array[$enterNumber]}
if [ "$file_chosen" == "" ]
then
echo "Error: Invalid selection"
continue
else
break
fi
else
echo "Error: Invalid selection"
continue
fi
done
fi
if [ ! -d "original_update/$file_chosen" ]
then
if [ "$file_chosen" == "system.img" ]
then
scripts/img_files_to_working_folder create_working $1
exit $?
elif [ "$file_chosen" == "factoryfs.rfs" ] || [ "$file_chosen" == "system.rfs" ]
then
scripts/rfs_files_to_working_folder create_working $1
exit $?
elif [ "$file_chosen" == "PDA.tar" ]
then
scripts/sgs_tar_files_to_working_folder create_working $1
exit $?
elif [ "$file_chosen" == "PDA.tar.md5" ]
then
scripts/sgs_tarmd5_files_to_working_folder create_working $1
exit $?
elif [ "$file_chosen" == "factoryfs.img" ]
then
scripts/simg_files_to_working_folder create_working $1
exit $?
elif [ "$file_chosen" == "system.img.ext4" ]
then
scripts/simg_ext4_files_to_working_folder create_working $1
exit $?
elif [ "$file_chosen" == "system.ext4.tar" ]
then
scripts/sext4_tar_files_to_working_folder create_working $1
exit $?
elif [ "`echo $file_chosen | grep -i \\.zip$`" != "" ]
then
scripts/zip_file_to_working_folder "$file_chosen" $1
exit $?
elif [ "`echo $file_chosen | grep -i \\.tar$`" != "" ]
then
scripts/tar_file_to_working_folder "$file_chosen" $1
exit $?
elif [ "`echo $file_chosen | grep -i \\.app$`" != "" ]
then
scripts/app_file_to_working_folder "$file_chosen" $1
exit $?
fi
else
if [ "`echo $file_chosen | grep -m 1 \"^WORKING_\"`" != "" ]
then
scripts/wkg_to_working_folder "$file_chosen" $1
exit $?
fi
fi