-
Notifications
You must be signed in to change notification settings - Fork 32
344 lines (329 loc) · 11.8 KB
/
rom_dumper.yml
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: Auto Firmware Dumper
on:
workflow_dispatch:
inputs:
FIRMWARE_URL:
description: 'Stock ROM Link'
required: true
default: ''
GENERATE_VENDOR:
description: 'Create Vendor Tree'
required: true
default: ''
type: choice
options:
- Okay
- I do not want
UPLOAD_LINEAGE_DT:
description: 'Upload LineageOS tree'
required: true
default: ''
type: choice
options:
- Okay
- I do not want
UPLOAD_TWRP_DT:
description: 'Upload TWRP tree'
required: true
default: ''
type: choice
options:
- Okay
- I do not want
USER_NAME:
description: 'Name in GitHub Account'
required: true
default: ''
USER_EMAIL:
description: 'E-mail in GitHub Account'
required: true
default: ''
jobs:
build:
name: Auto Firmware Dumper
if: github.event.repository.owner.id == github.event.sender.id
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GTOKEN }}
TWT: ${{ github.event.inputs.UPLOAD_TWRP_DT }}
LOT: ${{ github.event.inputs.UPLOAD_LINEAGE_DT }}
GVT: ${{ github.event.inputs.GENERATE_VENDOR }}
FUR: ${{ github.event.inputs.FIRMWARE_URL }}
UN: ${{ github.event.inputs.USER_NAME }}
UEM: ${{ github.event.inputs.USER_EMAIL }}
permissions:
contents: write
steps:
- name: Check Out
uses: actions/checkout@v3
- name: Cleanup
uses: rokibhasansagar/slimhub_actions@main
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 12
- name: Update Packages
run: |
sudo apt update
sudo apt -y upgrade
sudo apt -y install cpio aria2 git python3 neofetch tar gzip
- name: Setup GithubCLI
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- name: Clone and Setup DumprX
run: |
cd /home
sudo mkdir mode=777 Auto-Dumper
cd Auto-Dumper
git clone https://github.com/YZBruh/DumprX
cd DumprX
sudo chmod 777 *.sh
bash setup.sh
pip3 install aospdtgen
pip3 install twrpdtgen
- name: Creating Dump
run: |
cd /home/Auto-Dumper/DumprX
sudo bash dumper.sh "${{ env.FUR }}"
sudo chmod -R 777 out
- name: Setting up Git
run: |
git config --global user.name "${{ env.UN }}"
git config --global user.email "${{ env.UEM }}"
- name: Uploading ROM Dump
run: |
cd /home/Auto-Dumper/DumprX/out
sudo chmod -R 777 *
if [ -d system ]; then
echo " "
else
echo "Failed!";
cd /home/Auto-Dumper
sudo rm -rf DumprX
exit 1;
fi;
los_dir="lineage-device-tree"
if [ -d "$los_dir" ]; then
cp -r $los_dir /home/Auto-Dumper
else
echo "Lineage device tree not found!";
fi;
tw_dir="twrp-device-tree"
if [ -d "$tw_dir" ]; then
cp -r $tw_dir /home/Auto-Dumper
else
echo "TWRP device tree not found!";
unset tw_dir
fi;
if [ -d vendor ]; then
cd vendor
else
cd system
if [ -d system ]; then
cd system
fi
fi
codename=$(grep "ro.product.vendor.device=" build.prop | cut -d'=' -f2)
brand=$(grep "ro.product.vendor.brand=" build.prop | cut -d'=' -f2)
if [ "$codename" == "" ]; then
unset codename
codename=$(grep "ro.vendor.product.device=" build.prop | cut -d'=' -f2)
if [ "$codename" == "" ]; then
unset codename
codename=$(grep "ro.product.device=" build.prop | cut -d'=' -f2)
fi
fi
if [ "$brand" == "" ]; then
unset brand
brand=$(grep "ro.vendor.product.brand=" build.prop | cut -d'=' -f2)
if [ "$brand" == "" ]; then
unset brand
brand=$(grep "ro.product.brand=" build.prop | cut -d'=' -f2)
fi
fi
new_brand=$(echo "$brand" | tr 'A-Z' 'a-z')
unset brand
brand=$new_brand
new_codename=$(echo "$codename")
codename=$(echo "$new_codename" | tr -d '[:space:]')
cd /home/Auto-Dumper
echo "$codename" >> codename.txt
echo "$brand" >> brand.txt
cd /home/Auto-Dumper/DumprX/out
cd system
if [ -d system ]; then
cd system
version=$(grep "ro.build.version.release_or_codename=" build.prop | cut -d'=' -f2)
fingerprint=$(grep "ro.system.build.fingerprint=" build.prop | cut -d'=' -f2)
cd /home/Auto-Dumper
echo "$version" >> version.txt
echo "$fingerprint" >> fingerprint.txt
cd /home/Auto-Dumper/DumprX/out
else
version=$(grep "ro.build.version.release_or_codename=" build.prop | cut -d'=' -f2)
fingerprint=$(grep "ro.system.build.fingerprint=" build.prop | cut -d'=' -f2)
cd /home/Auto-Dumper
echo "$version" >> version.txt
echo "$fingerprint" >> fingerprint.txt
cd /home/Auto-Dumper/DumprX/out
fi
sudo rm -rf .git
echo "Compressing images..."
max_size="48000000"
if [ -f recovery.img ]; then
if [[ $(stat -c %s recovery.img) -gt $max_size ]]; then
cp recovery.img /home/Auto-Dumper
gzip -f recovery.img
fi
fi
if [ -f boot.img ]; then
if [[ $(stat -c %s boot.img) -gt $max_size ]]; then
cp boot.img /home/Auto-Dumper
gzip -f boot.img
fi
fi
if [ -f vendor_boot.img ]; then
if [[ $(stat -c %s vendor_boot.img) -gt $max_size ]]; then
cp vendor_boot.img /home/Auto-Dumper
gzip -f vendor_boot.img
fi
fi
if [ -f init_boot.img ]; then
if [[ $(stat -c %s init_boot.img) -gt $max_size ]]; then
cp init_boot.img /home/Auto-Dumper
gzip -f init_boot.img
fi
fi
if [ -f dtbo.img ]; then
cp dtbo.img /home/Auto-Dumper
fi
if [ -f dtb.img ]; then
cp dtb.img /home/Auto-Dumper
fi
find /home/Auto-Dumper/DumprX/out -type f -size +50M -delete -exec echo "Deleted: "{} \;
dat=$(date +%Y%m%d)
git init
git branch -M dump-"$codename"-"$dat"
git add .
git commit -s -m "Dump for $brand $codename"
gh repo create dump_"$brand"_"$codename" --public --description="Dump for $brand $codename " --source=. --remote=origin --push
cd /home/Auto-Dumper
mkdir vnd_project
mkdir vnd_project/dump
mkdir vnd_project/android
mkdir vnd_project/android/device
mkdir vnd_project/android/device/"$brand"
mkdir vnd_project/android/device/"$brand"/"$codename"
cd /home/Auto-Dumper/DumprX/out
if [ -d "$los_dir" ]; then
mv /home/Auto-Dumper/DumprX/out/lineage-device-tree/* /home/Auto-Dumper/vnd_project/android/device/"$brand"/"$codename"
rm -rf $los_dir
else
echo "LINEAGEOS DEVİCE TREE NOT FOUND!"
echo "IF REQUESTED, VENDOR TREE WILL NOT BE CREATED"
fi
mv /home/Auto-Dumper/DumprX/out/* /home/Auto-Dumper/vnd_project/dump
- name: Create vendor tree
if: |
env.GVT == 'Okay'
run: |
cd /home/Auto-Dumper
codename=$(cat codename.txt)
brand=$(cat brand.txt)
cd vnd_project
echo "Controlling LineageOS device tree..."
if [ -d android/device/"$brand"/"$codename" ]; then
echo "Device tree found"
else
echo "LINEAGEOS DEVİCE TREE NOT FOUND!"
exit 1
fi
echo "Clonning LineageOS tools..."
git clone --depth=1 https://github.com/LineageOS/android_tools_extract-utils -b lineage-20.0 ./android/tools/extract-utils
echo "Done cloning extract-utils."
git clone --depth=1 https://github.com/LineageOS/android_prebuilts_extract-tools -b lineage-20.0 ./android/prebuilts/extract-tools
echo "Done cloning extract-tools."
sudo chmod 777 android/device/"$brand"/"$codename"/setup-makefiles.sh
cd android/device/"$brand"/"$codename"
sudo chmod 777 extract-files.sh
bash extract-files.sh /home/Auto-Dumper/vnd_project/dump/
echo "Done extracting and making files."
echo "Pushing as repository now."
- name: Uploading Vendor Tree
if: |
env.GVT == 'Okay'
run: |
cd /home/Auto-Dumper
codename=$(cat codename.txt)
brand=$(cat brand.txt)
cd vnd_project/android/vendor/"$brand"/"$codename"
sudo chmod -R 777 *
dat=$(date +%Y%m%d)
git init
git branch -M vendor-"$codename"-"$dat"
git add .
git commit -s -m "$codename : initial vendor tree"
gh repo create android_vendor_"$brand"_"$codename" --public --description="Vendor tree for $codename" --source=. --remote=origin --push
echo "Succesfull"
cd /home/Auto-Dumper
sudo rm -rf DumprX
sudo rm -rf vnd_project
- name: Uploading LineageOS Device Tree
if: |
env.LOT == 'Okay'
run: |
cd /home/Auto-Dumper
codename=$(cat codename.txt)
brand=$(cat brand.txt)
cd lineage-device-tree
dat=$(date +%Y%m%d)
git init
git branch -M lineage-"$codename"-"$dat"
git add .
git commit -s -m "$codename : LineageOS compatible device tree"
gh repo create lineage_device_"$brand"_"$codename" --public --description="LineageOS compatible tree for $codename " --source=. --remote=origin --push
continue-on-error: true
- name: Uploading TWRP Device Tree
if: |
env.TWT == 'Okay'
run: |
cd /home/Auto-Dumper
codename=$(cat codename.txt)
brand=$(cat brand.txt)
version=$(cat version.txt)
cd twrp-device-tree
dat=$(date +%Y%m%d)
if [ -f BoardConfig.mk ]; then
git init
git branch -M twrp-"$version"-"$dat"
git add .
git commit -s -m "$codename : TWRP compatible device tree"
gh repo create twrp_device_"$brand"_"$codename" --public --description="TWRP compatible tree for $codename " --source=. --remote=origin --push
else
cd $brand
cd $codename
git init
git branch -M twrp-"$version"-"$dat"
git add .
git commit -s -m "$codename : TWRP compatible device tree"
gh repo create twrp_device_"$brand"_"$codename" --public --description="TWRP compatible tree for $codename " --source=. --remote=origin --push
fi
continue-on-error: true
- name: Uploading preview of images
uses: actions/upload-artifact@v4
with:
name: Prewiew images
path: |
/home/Auto-Dumper/boot.img
/home/Auto-Dumper/recovery.img
/home/Auto-Dumper/vendor_boot.img
/home/Auto-Dumper/init_boot.img
/home/Auto-Dumper/dtbo.img
/home/Auto-Dumper/dtb.img
if-no-files-found: ignore
continue-on-error: true