22
33[[ $# = 0 ]] && echo " No Input" && exit 1
44
5- OS=` uname`
5+ OS=$( uname)
66if [ " $OS " = ' Darwin' ]; then
77 export LC_CTYPE=C
88fi
3737if echo " $1 " | grep -e ' ^\(https\?\|ftp\)://.*$' > /dev/null; then
3838 # 1DRV URL DIRECT LINK IMPLEMENTATION
3939 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" )
4141 else
4242 URL=$1
4343 fi
4444 cd " $PROJECT_DIR " /input || exit
4545 { 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
4747 URL=$( wget --server-response --spider " ${URL} " 2>&1 | awk -F" filename=" ' {print $2}' )
4848 fi
4949 detox " ${URL##*/ } "
5353fi
5454
5555ORG=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)
5858UNZIP_DIR=${FILE/ .$EXTENSION / }
5959PARTITIONS=" 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"
6060
@@ -108,7 +108,7 @@ if [[ -f "$PROJECT_DIR"/working/"${UNZIP_DIR}"/boot.img ]]; then
108108 rm -rf " ${OUTPUT} /dtb/00_kernel"
109109
110110 # # 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
112112 for dtb in $( find " ${OUTPUT_DTB} " -type f) ; do
113113 dtc -q -I dtb -O dts " ${dtb} " >> " ${OUTPUT} /dts/$( basename " ${dtb} " | sed ' s/\.dtb/.dts/' ) "
114114 done
236236cd " $PROJECT_DIR " /working/" ${UNZIP_DIR} " || exit
237237for p in $PARTITIONS ; do
238238 # Try to extract images via fsck.erofs
239- if [ -f $p .img ] && [ $p != " modem" ]; then
239+ if [ -f " $p " .img ] && [ " $p " != " modem" ]; then
240240 echo " Trying to extract $p partition via fsck.erofs."
241241 " $PROJECT_DIR " /Firmware_extractor/tools/fsck.erofs --extract=" $p " " $p " .img
242242 # Deletes images if they were correctly extracted via fsck.erofs
@@ -247,8 +247,7 @@ for p in $PARTITIONS; do
247247 if [[ -e " $p .img" ]]; then
248248 mkdir " $p " 2> /dev/null || rm -rf " ${p:? } " /*
249249 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
252251 rm " $p " .img > /dev/null 2>&1
253252 else
254253 echo " Couldn't extract $p partition via 7z. Using mount loop"
@@ -257,8 +256,7 @@ for p in $PARTITIONS; do
257256 $sudo_cmd cp -rf " ${p} /" * " ${p} _"
258257 $sudo_cmd umount " ${p} "
259258 $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
262260 rm -fv " $p " .img > /dev/null 2>&1
263261 else
264262 echo " Couldn't extract $p partition. It might use an unsupported filesystem."
@@ -468,7 +466,7 @@ chmod -R u+rwX ./* #ensure final permissions
468466find " $PROJECT_DIR " /working/" ${UNZIP_DIR} " -type f -printf ' %P\n' | sort | grep -v " .git/" > " $PROJECT_DIR " /working/" ${UNZIP_DIR} " /all_files.txt
469467
470468if [[ -n $GIT_OAUTH_TOKEN ]]; then
471- GITPUSH=(git push https://" $GIT_OAUTH_TOKEN " @github.com/$ORG /" ${repo,,} " .git " $branch " )
469+ GITPUSH=(git push https://" $GIT_OAUTH_TOKEN " @github.com/" $ORG " /" ${repo,,} " .git " $branch " )
472470 curl --silent --fail " https://raw.githubusercontent.com/$ORG /$repo /$branch /all_files.txt" 2> /dev/null && echo " Firmware already dumped!" && exit 1
473471 git init
474472 if [[ -z " $( git config --get user.email) " ]]; then
0 commit comments