2
2
3
3
[[ $# = 0 ]] && echo " No Input" && exit 1
4
4
5
- OS=` uname`
5
+ OS=$( uname)
6
6
if [ " $OS " = ' Darwin' ]; then
7
7
export LC_CTYPE=C
8
8
fi
37
37
if echo " $1 " | grep -e ' ^\(https\?\|ftp\)://.*$' > /dev/null; then
38
38
# 1DRV URL DIRECT LINK IMPLEMENTATION
39
39
if echo " $1 " | grep -e ' 1drv.ms' > /dev/null; then
40
- URL=` curl -I " $1 " -s | grep location | sed -e " s/redir/download/g" | sed -e " s/location: //g" `
40
+ URL=$( curl -I " $1 " -s | grep location | sed -e " s/redir/download/g" | sed -e " s/location: //g" )
41
41
else
42
42
URL=$1
43
43
fi
44
44
cd " $PROJECT_DIR " /input || exit
45
45
{ type -p aria2c > /dev/null 2>&1 && printf " Downloading File...\n" && aria2c -x16 -j" $( nproc) " " ${URL} " ; } || { printf " Downloading File...\n" && wget -q --content-disposition --show-progress --progress=bar:force " ${URL} " || exit 1; }
46
- if [[ ! -f " $( echo ${URL##*/ } | inline-detox) " ]]; then
46
+ if [[ ! -f " $( echo " ${URL##*/ } " | inline-detox) " ]]; then
47
47
URL=$( wget --server-response --spider " ${URL} " 2>&1 | awk -F" filename=" ' {print $2}' )
48
48
fi
49
49
detox " ${URL##*/ } "
53
53
fi
54
54
55
55
ORG=AndroidDumps # your GitHub org name
56
- FILE=$( echo ${URL##*/ } | inline-detox)
57
- EXTENSION=$( echo ${URL##* .} | inline-detox)
56
+ FILE=$( echo " ${URL##*/ } " | inline-detox)
57
+ EXTENSION=$( echo " ${URL##* .} " | inline-detox)
58
58
UNZIP_DIR=${FILE/ .$EXTENSION / }
59
59
PARTITIONS=" system systemex system_ext system_other vendor cust odm odm_ext oem factory product modem xrom oppo_product opproduct reserve india my_preload my_odm my_stock my_operator my_country my_product my_company my_engineering my_heytap my_custom my_manifest my_carrier my_region my_bigball my_version special_preload vendor_dlkm odm_dlkm system_dlkm mi_ext"
60
60
68
68
69
69
# clone other repo's
70
70
if [[ -d " $PROJECT_DIR /Firmware_extractor" ]]; then
71
- git -C " $PROJECT_DIR " /Firmware_extractor pull --recurse-submodules
71
+ git -C " $PROJECT_DIR " /Firmware_extractor pull --recurse-submodules --rebase
72
72
else
73
73
git clone -q --recurse-submodules https://github.com/AndroidDumps/Firmware_extractor " $PROJECT_DIR " /Firmware_extractor
74
74
fi
@@ -108,7 +108,7 @@ if [[ -f "$PROJECT_DIR"/working/"${UNZIP_DIR}"/boot.img ]]; then
108
108
rm -rf " ${OUTPUT} /dtb/00_kernel"
109
109
110
110
# # Check whether device-tree blobs were extracted or not
111
- if [ " $( find ${OUTPUT_DTB} -name " *.dtb" ) " ]; then
111
+ if [ " $( find " ${OUTPUT_DTB} " -name " *.dtb" ) " ]; then
112
112
for dtb in $( find " ${OUTPUT_DTB} " -type f) ; do
113
113
dtc -q -I dtb -O dts " ${dtb} " >> " ${OUTPUT} /dts/$( basename " ${dtb} " | sed ' s/\.dtb/.dts/' ) "
114
114
done
236
236
cd " $PROJECT_DIR " /working/" ${UNZIP_DIR} " || exit
237
237
for p in $PARTITIONS ; do
238
238
# Try to extract images via fsck.erofs
239
- if [ -f $p .img ] && [ $p != " modem" ]; then
239
+ if [ -f " $p " .img ] && [ " $p " != " modem" ]; then
240
240
echo " Trying to extract $p partition via fsck.erofs."
241
241
" $PROJECT_DIR " /Firmware_extractor/tools/fsck.erofs --extract=" $p " " $p " .img
242
242
# Deletes images if they were correctly extracted via fsck.erofs
@@ -247,8 +247,7 @@ for p in $PARTITIONS; do
247
247
if [[ -e " $p .img" ]]; then
248
248
mkdir " $p " 2> /dev/null || rm -rf " ${p:? } " /*
249
249
echo " Extraction via fsck.erofs failed, extracting $p partition via 7z"
250
- 7z x " $p " .img -y -o" $p " / > /dev/null 2>&1
251
- if [ $? -eq 0 ]; then
250
+ if 7z x " $p " .img -y -o" $p " / > /dev/null 2>&1 ; then
252
251
rm " $p " .img > /dev/null 2>&1
253
252
else
254
253
echo " Couldn't extract $p partition via 7z. Using mount loop"
@@ -257,8 +256,7 @@ for p in $PARTITIONS; do
257
256
$sudo_cmd cp -rf " ${p} /" * " ${p} _"
258
257
$sudo_cmd umount " ${p} "
259
258
$sudo_cmd cp -rf " ${p} _/" * " ${p} "
260
- $sudo_cmd rm -rf " ${p} _"
261
- if [ $? -eq 0 ]; then
259
+ if $sudo_cmd rm -rf " ${p} _" ; then
262
260
rm -fv " $p " .img > /dev/null 2>&1
263
261
else
264
262
echo " Couldn't extract $p partition. It might use an unsupported filesystem."
@@ -283,9 +281,6 @@ if [ -e "$PROJECT_DIR"/working/"${UNZIP_DIR}"/vendor/build.prop ]; then
283
281
fi
284
282
sort -u -o " $PROJECT_DIR " /working/" ${UNZIP_DIR} " /board-info.txt " $PROJECT_DIR " /working/" ${UNZIP_DIR} " /board-info.txt
285
283
286
- # set variables
287
- ls system/build* .prop 2> /dev/null || ls system/system/build* .prop 2> /dev/null || { echo " No system build*.prop found, pushing cancelled!" && exit ; }
288
-
289
284
# 'flavor' property (e.g. caiman-user)
290
285
flavor=$( rg -m1 -INoP --no-messages " (?<=^ro.build.flavor=).*" {vendor,system,system/system}/build.prop)
291
286
[[ -z ${flavor} ]] && flavor=$( rg -m1 -INoP --no-messages " (?<=^ro.vendor.build.flavor=).*" vendor/build* .prop)
@@ -468,7 +463,7 @@ chmod -R u+rwX ./* #ensure final permissions
468
463
find " $PROJECT_DIR " /working/" ${UNZIP_DIR} " -type f -printf ' %P\n' | sort | grep -v " .git/" > " $PROJECT_DIR " /working/" ${UNZIP_DIR} " /all_files.txt
469
464
470
465
if [[ -n $GIT_OAUTH_TOKEN ]]; then
471
- GITPUSH=(git push https://" $GIT_OAUTH_TOKEN " @github.com/$ORG /" ${repo,,} " .git " $branch " )
466
+ GITPUSH=(git push https://" $GIT_OAUTH_TOKEN " @github.com/" $ORG " /" ${repo,,} " .git " $branch " )
472
467
curl --silent --fail " https://raw.githubusercontent.com/$ORG /$repo /$branch /all_files.txt" 2> /dev/null && echo " Firmware already dumped!" && exit 1
473
468
git init
474
469
if [[ -z " $( git config --get user.email) " ]]; then
0 commit comments