-
Notifications
You must be signed in to change notification settings - Fork 30
executable file
·245 lines (223 loc) · 8.16 KB
/
Copy pathdump.yml
File metadata and controls
executable file
·245 lines (223 loc) · 8.16 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
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
# =============================================================================
# SamFWDumper - Automated Samsung Firmware Extraction
# Copyright (C) 2026 Xiatsuma
# Licensed under PolyForm Noncommercial License 1.0.0
# https://polyformproject.org/licenses/noncommercial/1.0.0
#
# You may NOT use this file except in compliance with the License.
# Commercial use, removal of this header, or distribution without attribution
# is strictly prohibited. For permissions: https://github.com/Xiatsuma
# =============================================================================
name: Images Extractor
on:
workflow_dispatch:
inputs:
url:
description: 'SamFW Direct Download Link'
required: true
compression:
description: 'Compression level'
required: true
default: '0'
type: choice
options:
- '0'
- '3'
- '6'
- '9'
upload_destination:
description: 'Upload destination'
required: true
default: 'gofile'
type: choice
options:
- 'gofile'
- 'github releases'
extract_system:
description: 'system.img'
type: boolean
default: false
extract_system_ext:
description: 'system_ext.img'
type: boolean
default: false
extract_product:
description: 'product.img'
type: boolean
default: false
extract_vendor:
description: 'vendor.img'
type: boolean
default: false
extract_vendor_boot:
description: 'vendor_boot.img'
type: boolean
default: false
extract_vendor_dlkm:
description: 'vendor_dlkm.img'
type: boolean
default: false
extract_system_dlkm:
description: 'system_dlkm.img'
type: boolean
default: false
extract_odm:
description: 'odm.img'
type: boolean
default: false
extract_odm_dlkm:
description: 'odm_dlkm.img'
type: boolean
default: false
extract_boot:
description: 'boot.img'
type: boolean
default: false
extract_init_boot:
description: 'init_boot.img'
type: boolean
default: false
extract_vbmeta:
description: 'vbmeta.img'
type: boolean
default: false
extract_vbmeta_system:
description: 'vbmeta_system.img'
type: boolean
default: false
extract_dtbo:
description: 'dtbo.img'
type: boolean
default: false
extract_recovery:
description: 'recovery.img'
type: boolean
default: false
jobs:
dump:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
jq \
xz-utils \
lz4 \
unzip \
curl \
binutils \
android-sdk-libsparse-utils
- name: Make tools executable
run: chmod +x tools/android-tools/* tools/erofs-utils/* upload_gofile.sh scripts/dump.sh
- name: Run Dump Script
run: |
PARTITIONS=""
${{ github.event.inputs.extract_system }} && PARTITIONS="$PARTITIONS system"
${{ github.event.inputs.extract_system_ext }} && PARTITIONS="$PARTITIONS system_ext"
${{ github.event.inputs.extract_product }} && PARTITIONS="$PARTITIONS product"
${{ github.event.inputs.extract_vendor }} && PARTITIONS="$PARTITIONS vendor"
${{ github.event.inputs.extract_vendor_boot }} && PARTITIONS="$PARTITIONS vendor_boot"
${{ github.event.inputs.extract_vendor_dlkm }} && PARTITIONS="$PARTITIONS vendor_dlkm"
${{ github.event.inputs.extract_system_dlkm }} && PARTITIONS="$PARTITIONS system_dlkm"
${{ github.event.inputs.extract_odm }} && PARTITIONS="$PARTITIONS odm"
${{ github.event.inputs.extract_odm_dlkm }} && PARTITIONS="$PARTITIONS odm_dlkm"
${{ github.event.inputs.extract_boot }} && PARTITIONS="$PARTITIONS boot"
${{ github.event.inputs.extract_init_boot }} && PARTITIONS="$PARTITIONS init_boot"
${{ github.event.inputs.extract_vbmeta }} && PARTITIONS="$PARTITIONS vbmeta"
${{ github.event.inputs.extract_vbmeta_system }} && PARTITIONS="$PARTITIONS vbmeta_system"
${{ github.event.inputs.extract_dtbo }} && PARTITIONS="$PARTITIONS dtbo"
${{ github.event.inputs.extract_recovery }} && PARTITIONS="$PARTITIONS recovery"
PARTITIONS="${PARTITIONS# }"
if [ -z "$PARTITIONS" ]; then
echo "❌ No partitions selected! Please check at least one box."
exit 1
fi
bash scripts/dump.sh \
"${{ github.event.inputs.url }}" \
"${{ github.event.inputs.compression }}" \
"$PARTITIONS"
- name: Get Firmware Info
id: fwinfo
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
AP_CODE=$(cat ap_code.txt 2>/dev/null || echo "Unknown")
CSC_CODE=$(cat csc_code.txt 2>/dev/null || echo "Unknown")
BASE_TAG=$(date +"%d%m%Y_%H,%M,%S")
RELEASE_TAG="$BASE_TAG"
if gh release view "$RELEASE_TAG" &>/dev/null 2>&1; then
SUFFIX=1
while gh release view "${BASE_TAG}_${SUFFIX}" &>/dev/null 2>&1; do
SUFFIX=$((SUFFIX + 1))
done
RELEASE_TAG="${BASE_TAG}_${SUFFIX}"
fi
echo "ap_code=$AP_CODE" >> $GITHUB_OUTPUT
echo "csc_code=$CSC_CODE" >> $GITHUB_OUTPUT
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
- name: Upload to GoFile
if: ${{ github.event.inputs.upload_destination == 'gofile' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ ! -d "processed" ] || [ -z "$(ls -A processed)" ]; then
echo "❌ No files to upload"
exit 1
fi
NOTES_FILE=$(mktemp)
LINKS_FILE="links.txt"
> "$LINKS_FILE"
for FILE in processed/*; do
[ -f "$FILE" ] || continue
BASENAME=$(basename "$FILE")
if bash upload_gofile.sh "$FILE"; then
GOFILE_URL=$(cat download_url.txt)
echo "${BASENAME}: ${GOFILE_URL}" >> "$NOTES_FILE"
echo "${GOFILE_URL}" >> "$LINKS_FILE"
else
echo "${BASENAME}: ❌ GoFile upload failed" >> "$NOTES_FILE"
fi
done
gh release create "${{ steps.fwinfo.outputs.release_tag }}" \
--title "${{ steps.fwinfo.outputs.ap_code }} | ${{ steps.fwinfo.outputs.csc_code }}" \
--notes-file "$NOTES_FILE" \
"$LINKS_FILE"
rm -f "$NOTES_FILE"
- name: Upload to GitHub Releases
if: ${{ github.event.inputs.upload_destination == 'github releases' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ ! -d "processed" ] || [ -z "$(ls -A processed)" ]; then
echo "❌ No files to upload"
exit 1
fi
NOTES_FILE=$(mktemp)
ASSETS=()
SIZE_LIMIT=2147483648
for FILE in processed/*; do
[ -f "$FILE" ] || continue
FILESIZE=$(stat -c%s "$FILE")
BASENAME=$(basename "$FILE")
PART_NAME=$(echo "$BASENAME" | sed 's/\.img.*//')
if [ "$FILESIZE" -gt "$SIZE_LIMIT" ]; then
if bash upload_gofile.sh "$FILE"; then
GOFILE_URL=$(cat download_url.txt)
echo "${PART_NAME}: ${GOFILE_URL}" >> "$NOTES_FILE"
else
echo "${PART_NAME}: ❌ GoFile upload failed" >> "$NOTES_FILE"
fi
else
ASSETS+=("$FILE")
fi
done
gh release create "${{ steps.fwinfo.outputs.release_tag }}" \
--title "${{ steps.fwinfo.outputs.ap_code }} | ${{ steps.fwinfo.outputs.csc_code }}" \
--notes-file "$NOTES_FILE" \
"${ASSETS[@]}"
rm -f "$NOTES_FILE"