-
Notifications
You must be signed in to change notification settings - Fork 1
/
dump.sh
executable file
·42 lines (35 loc) · 953 Bytes
/
dump.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
#!/bin/bash
# Usage: ./dump.sh FullPackage firstpackage secondpackage
# Example: ./dump.sh OP9 1 2
# This will extract OP9.zip and apply OP9-1.zip OTA to OP9.zip, then apply OP9-2.zip and so on
rm -rf ota
rm -rf extracted
# Extract full update
unzip packages/$1.zip payload.bin
mv payload.bin payload_working.bin
mkdir ota
(
./bin/ota_extractor -output_dir ota -payload payload_working.bin
rm payload_working.bin
)
# Apply incrementals
for i in ${@:2}; do
echo "Applying $1-$i..."
unzip packages/$1-$i payload.bin
wait
mv payload.bin payload_working.bin
(
mkdir ota_new
./bin/ota_extractor -input-dir ota -output_dir ota_new -payload payload_working.bin
rm -rf ota
mv ota_new ota
rm payload_working.bin
) &
done
wait
# Prompt to run "extract-blobs.sh"
read -p "Do you want to extract blobs? (y/n): " choice
if [ "$choice" == "y" ]; then
./extract-blobs.sh
fi
echo "Done"