@@ -137,16 +137,16 @@ cleanup () {
137137decompress () {
138138 if [ -z " $full_unzipped " ]; then
139139 if [ -z " $1 " ] || [ " $2 " != " -n" ]; then
140- unzip -qq -n " $ipadir " " $1 " -d " $dir "
140+ unzip -qq -n " $ipadir " " $1 " -d " $dir / "
141141 else
142- unzip -qq -o " $ipadir " " $1 " -d " $dir "
142+ unzip -qq -o " $ipadir " " $1 " -d " $dir / "
143143 fi
144144 fi
145145}
146146
147147network_check (){
148148 if [ -z " $net " ]; then
149- if curl -I --connect-timeout 1 google.com & > /dev/null; then
149+ if curl -I --connect-timeout 5 google.com & > /dev/null; then
150150 net=0
151151 else
152152 net=1
@@ -156,6 +156,14 @@ network_check(){
156156 return " $net "
157157}
158158
159+ verlt () {
160+ if [ " $1 " = " $2 " ]; then
161+ return 1
162+ else
163+ [ " $1 " = " $( echo -e " $1 \n$2 " | sort -V | head -n1) " ]
164+ fi
165+ }
166+
159167help () {
160168 echo " Usage: azule [essential arguements] [modifiers]"
161169 echo
@@ -180,7 +188,6 @@ help () {
180188 echo " -u Remove UISupportedDevices from app"
181189 echo " -S Fakesigns iPA for use with AppSync"
182190 echo " -e Removes App Extensions"
183- echo " -y Don't remove watch app"
184191
185192 if [ -e " $azule /modules/azule_apt" ]; then
186193 echo
@@ -192,7 +199,7 @@ help () {
192199 echo " -D Disable refreshing Procursus/Elcubratus repos"
193200 fi
194201
195- if [ -e " $azule /modules/ azule_decrypt" ]; then
202+ if [ -n " $azule_decrypt " ]; then
196203 echo
197204 echo " Decrypt Module:"
198205 echo " -x [Apple ID] [Password] Fetch and decrypt iPA with specified Apple ID"
@@ -204,6 +211,8 @@ help () {
204211 echo
205212 echo " Others:"
206213 echo " -n [Name] Specify a name for the Output iPA"
214+ echo " -y Don't remove watch app"
215+ echo " -m Don't inect a hooking library"
207216
208217 if [ " $os " == " Linux" ]; then
209218 echo " -R Redownload the latest substrate, substitute, and toolchain"
@@ -331,6 +340,9 @@ case "$os" in
331340 iOS)
332341 PATH=" /usr/lib/Azule/bin:$PATH "
333342 azule=" /usr/lib/Azule"
343+ if [ -e " $azule /modules/azule_decrypt" ]; then
344+ azule_decrypt=1
345+ fi
334346 ;;
335347
336348 Linux)
@@ -345,7 +357,7 @@ trap "cleanup" SIGINT
345357trap " cleanup" EXIT
346358
347359# CLI ARGUEMENTS
348- while getopts n:i:o:c:b:x:f:p:C:huSewsrDHqAdjRyUzgFLklv args; do
360+ while getopts n:i:o:c:b:x:f:p:C:huSewsrDHqAdjRyUzgmFLklv args; do
349361
350362 # STUFF WITH PARAMETERS
351363 if [[ " $args " == @ (x| n| b| p| i| o| c| f| A| z) ]]; then
@@ -370,7 +382,7 @@ while getopts n:i:o:c:b:x:f:p:C:huSewsrDHqAdjRyUzgFLklv args; do
370382 Announce " -$args requires the module azule_apt which is not installed" 34
371383 fi
372384
373- if [ ! -e " $azule /modules/ azule_decrypt" ] && [[ " $args " == @ (x| C| y| g| k| l) ]]; then
385+ if [ -n " $azule_decrypt " ] && [[ " $args " == @ (x| C| y| g| k| l) ]]; then
374386 Announce " -$args requires the module azule_decrypt which is not installed" 34
375387 fi
376388
@@ -381,16 +393,18 @@ while getopts n:i:o:c:b:x:f:p:C:huSewsrDHqAdjRyUzgFLklv args; do
381393 b) bundle=" ${tmp[*]} " && run=1 ;;
382394 c) custom_version=" ${tmp[*]} " && run=1 ;;
383395 f) split_array files " ${tmp[*]} " && run=1 ;;
384- i) ipadir=" $( expand " ${tmp[*]} " ) " ;;
396+ i) ipadir=" $( expand " ${tmp[*]} " ) " && if [ -n " $azule_decrypt " ] && [[ " $ipadir " != @ ( * .app | * .ipa ) ]] ; then run=1 ; fi ;;
385397 n) name=" ${tmp[*]} " ;;
386398 o) outdir=" $( expand " ${tmp[*]} " ) " ;;
387399 p) displayname=" ${tmp[*]} " && run=1 ;;
388400 x) IPATOOL_EMAIL=" ${tmp[0]} " && unset " tmp[0]" && IPATOOL_PASSWORD=" ${tmp[*]} " ;;
389401 C) country_code=" ${tmp[*]} " ;;
390402
391403 # SWITCHES
404+ d) no_recurse=1 ;;
392405 e) remove_extensions=1 && run=1 ;;
393406 j) allow_root_run=1 ;;
407+ m) no_inject_hl=1 ;;
394408 q) ignore_errors=1 ;;
395409 r) ignore_encrypted=1 ;;
396410 s) silent_run=1 ;;
@@ -400,7 +414,6 @@ while getopts n:i:o:c:b:x:f:p:C:huSewsrDHqAdjRyUzgFLklv args; do
400414 y) no_remove_watchapp=1 ;;
401415 w) weak=1 ;;
402416 L) ignore_canister=1 ;;
403- d) no_recurse=1 ;;
404417 D) disable_dists=1 ;;
405418 z) legacy_compression=1 ;;
406419
@@ -521,7 +534,7 @@ if [ -z "$outdir" ]; then
521534 Announce " No Output Directory Specified. Run 'azule -h' for help" 27
522535elif [ -z " $ipadir " ]; then
523536 Announce " No iPA Specified. Run 'azule -h' for help" 27
524- elif [[ -z " $run " ] ]; then
537+ elif [ -z " $run " ]; then
525538 Announce " No Modifiers Specified. Run 'azule -h' for help" 27
526539fi
527540
@@ -550,12 +563,11 @@ if [ -e "$ipadir" ]; then
550563 full_unzipped=1
551564 fi
552565else
553- # ##
554- if [ " $os " == " iOS" ] && [ -e " $azule /modules/azule_decrypt" ]; then
566+ if [ -n " $azule_decrypt " ]; then
555567 source " $azule " /modules/azule_decrypt
556568 fi
557569
558- if [ ! -e " $ipadir " ]; then
570+ if [ ! -e Payload ]; then
559571 Announce " Invalid App" 8
560572 fi
561573fi
@@ -729,18 +741,26 @@ if [ -n "${files[*]}" ]; then
729741 fi
730742 done < <( find " $dir /Tweak" " $dir /Custom" ! -type l -iname ' *.framework' ! -path ' *PreferenceBundles/*' ! -path ' *.framework/*' 2> /dev/null)
731743
732- # MERGING APPLICATION SUPPORT
744+ # MOVING BUNDLES
733745 while read -r i; do
746+ rm -rf " Payload/$appname /$( basename " $i " ) "
734747 mv " $i " " Payload/$appname /"
735748 Verbose " Copied $( basename " $i " ) to app directory" " $( basename " $i " ) couldn't be copied to app directory" 16 -v
736- done < <( find " $dir /Tweak/Library/Application Support" -mindepth 2 -maxdepth 2 ! -type l ! -path ' *.bundle/*' ! -path ' *.framework/*' 2> /dev/null)
749+ done < <( find " $dir /Tweak/Library/Application Support" ! -type l -iname ' *.bundle ' ! -path ' *.appex/* ' ! -path ' *.bundle/*' ! -path ' *.framework/*' 2> /dev/null)
737750
738- # MOVING BUNDLES
751+ # MERGING APPLICATION SUPPORT
739752 while read -r i; do
740753 rm -rf " Payload/$appname /$( basename " $i " ) "
741754 mv " $i " " Payload/$appname /"
742755 Verbose " Copied $( basename " $i " ) to app directory" " $( basename " $i " ) couldn't be copied to app directory" 16 -v
743- done < <( find " $dir /Tweak/Library/Application Support" ! -type l -iname ' *.bundle' ! -path ' *.bundle/*' ! -path ' *.framework/*' 2> /dev/null)
756+ done < <( find " $dir /Tweak/Library/Application Support" -mindepth 2 -maxdepth 2 ! -type l ! -path ' *.appex/*' ! -path ' *.bundle/*' ! -path ' *.framework/*' 2> /dev/null)
757+
758+ # MOVING EXTENSIONS
759+ while read -r i; do
760+ rm -rf " Payload/$appname /PlugIns/$( basename " $i " ) "
761+ mv " $i " " Payload/$appname /PlugIns/"
762+ Verbose " Copied $( basename " $i " ) to app directory" " $( basename " $i " ) couldn't be copied to app directory" 16 -v
763+ done < <( find " $dir /Tweak" " $dir /Custom" ! -type l -iname ' *.appex' ! -path ' *.appex/*' ! -path ' *.bundle/*' ! -path ' *.framework/*' 2> /dev/null)
744764
745765 # FIXING LINKS
746766 for i in " ${inject[@]} " ; do
@@ -777,7 +797,7 @@ if [ -n "${files[*]}" ]; then
777797 fi
778798
779799 # INJECT HOOKING LIBRARY
780- if [ -n " ${inject[*]} " ]; then
800+ if [ -n " ${inject[*]} " ] && [ -z " $no_inject_hl " ] ; then
781801 for hookinglibrary in " CydiaSubstrate.framework/CydiaSubstrate" " libsubstitute.dylib" ; do
782802 hl=" $hookinglibrary "
783803 if [[ " $hl " =~ .framework ]]; then
@@ -930,6 +950,22 @@ if [ -n "$run" ] || [ -n "$foul_plist" ]; then
930950 fi
931951 Verbose " Generated IPA at $outdir " " Couldn't generate IPA" 25 -X
932952
953+ # REMOVING WATCH APP
954+ if [ -z " $no_remove_watchapp " ]; then
955+ decompress " *Info.plist*" -n
956+ while read -r i; do
957+ DTPlatformName=" $( ExtractPlistValue DTPlatformName " $i " ) "
958+ if [ " $DTPlatformName " == " watchos" ]; then
959+ if [ -d " $( dirname " $i " ) " ]; then
960+ zip -qq -d " $outdir " " $( dirname " $i " ) /*" & > /dev/null
961+ stat=" $? "
962+ if [ " $stat " != " 12" ]; then status=$(( status + "$stat " )) ; fi
963+ fi
964+ fi
965+ done < <( find " $dir /Payload" -name " Info.plist" )
966+ Verbose " Removed Watch App" " Couldn't Remove Watch App" -x -v
967+ fi
968+
933969 # REMOVING EXTENSIONS
934970 if [ -n " $remove_extensions " ]; then
935971 zip -qq -d " $outdir " " Payload/*.app/PlugIns/*" & > /dev/null
0 commit comments