-
Notifications
You must be signed in to change notification settings - Fork 4
/
hh.sh
133 lines (125 loc) · 3.65 KB
/
hh.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
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
#!/bin/sh
codename="picasso"
bhlnk="https://github.com/buihien224/host/raw/main/zipping.zip"
scpt="tmp/META-INF/com/google/android/updater-script"
user=$(whoami)
mod=0
#####
cd ~/
if [[ -d "output_picasso" ]]
then
echo "mk output folder"
else
mkdir output
fi
rm -r tmp
pwd=$(pwd)
echo "Working dir : "$pwd""
echo ""
echo -e "\e[1;33mGenerate GSI Flashing Template @bhlnk \e[0m"
sleep 0.5
echo -e "\e[1;33mFor Dynamic Partition Device \e[0m"
sleep 0.5
echo -e "\e[1;32mEnter Gsi name \e[0m"
read gsi
echo -e "\e[1;33mYour Device Is $codename and \e[0m"
sleep 0.5
######
check ()
{
if [[ -f "zipping.zip" ]]
then
echo "extracting template"
unzip zipping.zip
else
echo "downloading template"
wget -q $bhlnk
if [[ -f "zipping.zip" ]]
then
unzip zipping.zip
else echo "report to @bhlnk"
exit 1
fi
fi
}
mksys()
{
rm tmp/vendor_op_list
echo -e "\e[1;33mGenerating system flashable\e[0m"
systemsize=$(find "system.img" -printf "%s")
echo -e "\e[1;33mCoping system.img...\e[0m"
cp system.img tmp
sed -i "s/test/$codename/g" $scpt
sed -i "s/160600/$systemsize/g" tmp/dynamic_partitions_op_list
echo "set_progress(1.000000);" >> $scpt
echo -e "\e[1;33mZipping........\e[0m"
for dir in tmp; do
( cd "$dir" && zip -r ../"$gsi"_"$codename".zip . )
done
mv "$gsi"_"$codename".zip output
rm -r tmp
echo -e "\e[1;32mDone Flash "$gsi"_"$codename".zip\e[0m"
echo -e "\e[1;32mIn Custom Recovery\e[0m"
sleep 5
exit 1
}
mkvendor()
{
echo -e "\e[1;33mGenerating system and vendor flashable\e[0m"
systemsize=$(find "system.img" -printf "%s")
vendorsize=$(find "vendor.img" -printf "%s")
echo -e "\e[1;33mCoping system.img...\e[0m"
cp system.img tmp
echo -e "\e[1;33mCoping vendor.img...\e[0m"
cp vendor.img tmp
sed -i "s/test/$codename/g" $scpt
sed -i "s/160600/$systemsize/g" tmp/dynamic_partitions_op_list
sed -i "s/010120/$vendorsize/g" tmp/vendor_op_list
echo "assert(update_dynamic_partitions(package_extract_file("vendor_op_list")));
package_extract_file("vendor.img", map_partition("vendor"));" >> $scpt
echo "set_progress(1.000000);" >> $scpt
echo -e "\e[1;33mZipping........\e[0m"
for dir in tmp; do
( cd "$dir" && zip -r ../"$gsi"_"$codename".zip . )
done
mv "$gsi"_"$codename".zip output
rm -r tmp
echo -e "\e[1;32mDone Flash "$gsi"_"$codename".zip\e[0m"
echo -e "\e[1;32mIn Custom Recovery\e[0m"
sleep 5
exit 1
}
mkfull()
{
echo -e "\e[1;33mGenerating full zip rom from img files \e[0m"
systemsize=$(find "system.img" -printf "%s")
productsize=$(find "product.img" -printf "%s")
sysextsize=$(find "system_ext.img" -printf "%s")
echo -e "\e[1;33mCoping system.img...\e[0m"
cp system.img tmp
echo -e "\e[1;33mCoping product.img...\e[0m"
cp product.img tmp
echo -e "\e[1;33mCoping system_ext.img...\e[0m"
cp system_ext.img tmp
echo -e "\e[1;33mCoping boot.img...\e[0m"
cp boot.img tmp
echo -e "\e[1;33mCoping dtbo.img...\e[0m"
cp dtbo.img tmp
sed -i "s/test/$codename/g" $scpt
sed -i "s/160600/$systemsize/g" tmp/dynamic_partitions_op_list
echo "resize product $productsize" >> tmp/dynamic_partitions_op_list
echo "resize system_ext $sysextsize" >> tmp/dynamic_partitions_op_list
echo -e "\e[1;33mZipping........\e[0m"
for dir in tmp; do
( cd "$dir" && zip -r ../"$gsi"_"$codename".zip . )
done
mv "$gsi"_"$codename".zip output
rm -r tmp
echo -e "\e[1;32mDone Flash "$gsi"_"$codename".zip\e[0m"
echo -e "\e[1;32mIn Custom Recovery\e[0m"
sleep 5
exit 1
}
check
mkfull
#####