-
Notifications
You must be signed in to change notification settings - Fork 4
/
start.sh
executable file
·79 lines (72 loc) · 1.9 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
#!/bin/bash
dir=system
sys=tmp/system.img
sparse=tmp/system_sparse.img
clear
echo "#########################################"
echo " "
echo " Android Image Modifier "
echo " By Creator54 "
echo " "
echo "#########################################"
echo
zip_file="$(ls -a | grep .zip)"
if [[ -e "$zip_file" ]]; then
echo ROM found
mkdir tmp $dir
unzip $zip_file -d tmp | grep Archive
echo zip extracted.
if [[ -e "tmp/system.new.dat.br" ]]; then
brotli -f -d tmp/*.br
fi
file1=tmp/system.transfer.list
file2=tmp/system.new.dat
if [[ -f "$file1" ]] && [[ -f "$file2" ]]; then
echo
echo "Decompressing DAT (sparse data) -> EXT4 (raw image)"
echo
./sdat2img/sdat2img.py $file1 $file2 $sys | grep Done!
sudo mount -t ext4 -o loop $sys $dir
echo
echo "Now u can start editing $dir directory."
echo
read -p "Press enter to start repacking..." key
if [ "$key" = '' ]; then
sudo umount $dir
echo " "
echo Image unmounted
img2simg $sys $sparse
echo
echo Converting to sparse_img ...
if [[ -e "tmp/system.new.dat.br" ]]; then
./img2sdat/img2sdat.py $sparse -o tmp -v 4 | grep Done
echo
echo "System supports brotli compression."
echo
echo " 1 - fastest/least compression"
echo " 6 - default aosp compression"
echo "11 - slowest/max compression"
echo
read -p "Enter compression level(1-11): " l
brotli -f -$l tmp/system.new.dat
echo Brotli compression complete.
else
./img2sdat/img2sdat.py $sparse -o tmp
fi
fi
fi
echo
echo Finalizing New_$zip_file ...
echo
if [[ -e "tmp/system.new.dat.br" ]]; then
rm tmp/system.new.dat
fi
rm $sys $sparse && cd tmp
zip New_$zip_file -r *
mv New_$zip_file ../ && cd ../ && rm -rf tmp $dir
echo
echo "All Done. Time for testing :)"
echo
else
echo "Copy ROM zip to this dir."
fi