@@ -141,8 +141,8 @@ expand () {
141141 process_var=" $( echo " $process_var " | sed " s|\.|$rootdir |" ) "
142142 fi
143143
144- if ! [[ -f " $process_var " || -d " $process_var " ] ]; then
145- if [[ -f " $rootdir /$process_var " || -d " $rootdir / $process_var " ] ]; then
144+ if ! [ -e " $process_var " ]; then
145+ if [ -e " $rootdir /$process_var " ]; then
146146 process_var=" $rootdir /$process_var "
147147 fi
148148 fi
@@ -153,7 +153,7 @@ expand () {
153153}
154154
155155cleanup () {
156- if [[ " $os " == " iOS" && -f " $dir /$tweakid /bfbackup.plist" ]]; then
156+ if [[ " $os " == " iOS" && -e " $dir /$tweakid /bfbackup.plist" ]]; then
157157 mv " $dir /$tweakid /bfbackup.plist" /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist
158158 fi
159159 rm -rf " $dir "
@@ -216,22 +216,11 @@ while getopts :n:i:o:c:a:b:x:f:d:p:huSewmzglv args; do
216216 ;;
217217
218218 f)
219- tmpa =( " $OPTARG " )
219+ temp_files =( " $OPTARG " )
220220 until [[ $( eval " echo \$ {$OPTIND }" ) =~ ^-.* ]] || [ -z " $( eval " echo \$ {$OPTIND }" ) " ]; do
221- tmpa +=( " $( eval " echo \$ {$OPTIND }" ) " )
221+ temp_files +=( " $( eval " echo \$ {$OPTIND }" ) " )
222222 OPTIND=$(( OPTIND + 1 ))
223223 done
224-
225- for i in " ${tmpa[@]} " ; do
226- if [ -n " $tmp2 " ]; then
227- tmp2+=" "
228- fi
229- tmp2+=" $i "
230- if [ -f " $( expand " $tmp2 " ) " ] || [ -d " $( expand " $tmp2 " ) " ]; then
231- files+=( " $( expand " $tmp2 " ) " )
232- unset tmp2
233- fi
234- done
235224 run=1
236225 ;;
237226
@@ -247,14 +236,6 @@ while getopts :n:i:o:c:a:b:x:f:d:p:huSewmzglv args; do
247236 done
248237 ;;
249238
250- d)
251- inject=( " $OPTARG " )
252- until [[ $( eval " echo \$ {$OPTIND }" ) =~ ^-.* ]] || [ -z " $( eval " echo \$ {$OPTIND }" ) " ]; do
253- inject+=( " $( eval " echo \$ {$OPTIND }" ) " )
254- OPTIND=$(( OPTIND + 1 ))
255- done
256- ;;
257-
258239 u) u=1 && run=1 ;;
259240 v) v=" -v" ;;
260241 a) a=1
@@ -314,7 +295,6 @@ while getopts :n:i:o:c:a:b:x:f:d:p:huSewmzglv args; do
314295 echo " Optional Arguements"
315296 echo " -n [Name] Specify an Output Name"
316297 echo " -f [Paths/Bundle IDs] Specify the files or tweak Bundle IDs to import"
317- echo " -d [Names] Specify the names of the dylibs to inject (Not Recommended)"
318298 echo " -c [Version] Set custom version for output ipa"
319299 echo " -b [BundleId] Set custom BundleID for output ipa"
320300 echo " -p [Name] Set custom Display Name for output ipa"
@@ -369,7 +349,7 @@ do true; done; fi
369349
370350ipadir=" $( expand " $ipadir " ) "
371351
372- if [ ! -f " $ipadir " ]; then
352+ if [ ! -e " $ipadir " ]; then
373353 if [ " $os " != " iOS" ]; then
374354 echo " Invalid iPA"
375355 exit 1
@@ -418,19 +398,8 @@ if [[ -z "$run" && -z "$drun" ]]; then
418398 if [ -z " $files " ]; then while
419399 printf ' Files or Tweak IDs: '
420400 read -r tmp
421- tmpa=( $( eval " echo $tmp " ) )
422-
423- for i in " ${tmpa[@]} " ; do
424- if [ -n " $tmp2 " ]; then
425- tmp2+=" "
426- fi
427- tmp2+=" $i "
428- if [ -f " $( expand " $tmp2 " ) " ] || [ -d " $( expand " $tmp2 " ) " ]; then
429- files+=( " $tmp2 " )
430- unset tmp2
431- fi
432- done
433- [ -z " $files " ] && echo " No Files Provided"
401+ temp_files=( $( eval " echo $tmp " ) )
402+ [ -z " $temp_files " ] && echo " No Files Provided"
434403 do true ; done ; fi
435404 run=1
436405 ;;
@@ -530,13 +499,6 @@ if [ -z "$pswd" ] && [ -n "$a" ]; then
530499 pswd=" alpine"
531500fi
532501
533- # VERBOSE
534- if [[ -n " $v " && -n " $files " ]]; then
535- for i in " ${files[@]} " ; do
536- echo " $i will be imported"
537- done
538- fi
539-
540502# SETTING OUTPUT DIRECTORY AND NAME
541503if [ ! -d " $outdir " ]; then
542504 if [ " ${outdir: -4} " == " .ipa" ]; then
@@ -688,7 +650,7 @@ if [ -n "$drun" ]; then
688650 open " $ipadir "
689651
690652 # WAIT FOR IPA
691- until [ -f " $bfipadir " ]; do : ; done
653+ until [ -e " $bfipadir " ]; do : ; done
692654 while [ -d " $( dirname " $bfipadir " ) /ipa" ]; do : ; done
693655
694656 # KILL APP
@@ -699,15 +661,15 @@ if [ -n "$drun" ]; then
699661 ipadir=" $bfipadir "
700662
701663 # CLEANUP
702- if [ -f " $dir /$tweakid /bfbackup.plist" ]; then
664+ if [ -e " $dir /$tweakid /bfbackup.plist" ]; then
703665 mv " $dir /$tweakid /bfbackup.plist" /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist
704666 fi
705667 fi
706668fi
707669
708670# VERBOSE
709671if [ -n " $v " ]; then
710- if [ -f " $ipadir " ]; then
672+ if [ -e " $ipadir " ]; then
711673 echo " Path to IPA is $ipadir "
712674 else
713675 echo " Decrypted $ipadir "
717679# EXTRACTING IPA
718680if [[ -n " $run " && -z " $unzipped " ]]; then
719681 echo " Extracting iPA..."
720- eval " unzip -q ' $ipadir ' -d $dir /' $tweakid ' "
682+ unzip -q " $ipadir " -d " $dir /$tweakid "
721683 Verbose " IPA extracted" " Couldn't extract IPA"
722684fi
723685
@@ -765,10 +727,36 @@ if [ -n "$run" ]; then
765727 done < <( find Payload/* .app -name " Info.plist" )
766728fi
767729
730+ # INITIALIZING ${FILES}
731+
732+ x=0
733+ while [[ " $x " -lt " ${# temp_files[@]} " ]]; do
734+ temp_string+=" $( expand " ${temp_files[x]} " ) "
735+ x=$(( x + 1 ))
736+ until [[ -e " $( expand " $temp_string " ) " || -z " ${temp_files[x]} " ]]; do
737+ temp_string=" $temp_string ${temp_files[x]} "
738+ x=$(( x + 1 ))
739+ done
740+
741+ while [ -e " $( expand " $temp_string ${temp_files[x]} " ) " ]; do
742+ temp_string+=" ${temp_files[x]} "
743+ x=$(( x + 1 ))
744+ done
745+ files+=( " $( expand " $temp_string " ) " )
746+ unset temp_string
747+ done
748+
749+ # VERBOSE
750+ if [[ -n " $v " && -n " $files " ]]; then
751+ for i in " ${files[@]} " ; do
752+ echo " $i will be imported"
753+ done
754+ fi
755+
768756# PROCESSING FILES
769757if [ -n " $files " ]; then
770758 for i in " ${files[@]} " ; do
771- if [[ -f " $i " || -d " $i " ] ]; then
759+ if [ -e " $i " ]; then
772760 case " $i " in
773761 * .deb) ExtractDEB " $i " ;;
774762
@@ -822,9 +810,9 @@ if [ -n "$files" ]; then
822810 # SPECIFYING DYLIBS
823811 while read -r i; do dylibs+=(" $i " ); done < <( find " $dir /$tweakid /Tweak" " $dir /$tweakid /Custom" ! -type l -iname ' *.dylib' ! -path ' *.bundle/*' ! -path ' *.framework/*' )
824812
825- # AUTOMATIC DYLIB SELECTION
813+ # DYLIB SELECTION
826814 for i in " ${dylibs[@]} " ; do
827- if ! [ -f " ${i% .* } .plist" ]; then
815+ if ! [ -e " ${i% .* } .plist" ]; then
828816 inject+=( " $( basename " $i " ) " )
829817 else
830818 identifier=" $( ExtractPlistValue Filter " ${i% .* } " .plist) "
@@ -866,7 +854,7 @@ if [ -n "$files" ]; then
866854
867855 # MOVING FRAMEWORKS TO APP DIRECTORY
868856 while read -r i; do
869- if [ -f " $i /Info.plist" ]; then
857+ if [ -e " $i /Info.plist" ]; then
870858 rsync -a " $i " Payload/* .app/Frameworks
871859 Verbose " Copied $( basename " $i " ) to app directory" " $( basename " $i " ) couldn't be copied to app directory"
872860 inject+=( " $( basename " $i " ) /$( ExtractPlistValue CFBundleExecutable " $i /Info.plist" ) " )
0 commit comments