@@ -209,14 +209,30 @@ private void doInstall(File file,boolean noExtensions,boolean rootless) {
209209 "sh \" " + installScript .getAbsolutePath () + "\" " +
210210 " /dev/null 1 \" " + file .getAbsolutePath () + "\" " )
211211 .to (installerController , installerMonitor );
212- } else if (MainApplication .isUsingMagiskCommand () || noExtensions ) {
213- installerMonitor = new InstallerMonitor (new File (InstallerInitializer
214- .peekMagiskPath ().equals ("/sbin" ) ? "/sbin/magisk" : "/system/bin/magisk" ));
212+ } else {
213+ String installCommand ;
214+ File installExecutable ;
215+ if (InstallerInitializer .peekMagiskVersion () >=
216+ Constants .MAGISK_VER_CODE_INSTALL_COMMAND &&
217+ (noExtensions || MainApplication .isUsingMagiskCommand ())) {
218+ installCommand = "magisk --install-module \" " + file .getAbsolutePath () + "\" " ;
219+ installExecutable = new File (InstallerInitializer .peekMagiskPath ()
220+ .equals ("/sbin" ) ? "/sbin/magisk" : "/system/bin/magisk" );
221+ } else {
222+ installExecutable = this .extractInstallScript ("module_installer_compat.sh" );
223+ if (installExecutable == null ) {
224+ this .setInstallStateFinished (false ,
225+ "! Failed to extract module install script" , "" );
226+ return ;
227+ }
228+ installCommand = "sh \" " + installExecutable .getAbsolutePath () + "\" " +
229+ " /dev/null 1 \" " + file .getAbsolutePath () + "\" " ;
230+ }
231+ installerMonitor = new InstallerMonitor (installExecutable );
215232 if (noExtensions ) {
216233 installJob = Shell .su ( // No Extensions
217234 "cd \" " + this .moduleCache .getAbsolutePath () + "\" " ,
218- "magisk --install-module \" " + file .getAbsolutePath () + "\" " )
219- .to (installerController , installerMonitor );
235+ installCommand ).to (installerController , installerMonitor );
220236 } else {
221237 installJob = Shell .su ("export MMM_EXT_SUPPORT=1" ,
222238 "export MMM_USER_LANGUAGE=" + (MainApplication .isForceEnglish () ?
@@ -225,27 +241,8 @@ private void doInstall(File file,boolean noExtensions,boolean rootless) {
225241 "export MMM_APP_VERSION=" + BuildConfig .VERSION_NAME ,
226242 "export MMM_TEXT_WRAP=" + (this .textWrap ? "1" : "0" ),
227243 "cd \" " + this .moduleCache .getAbsolutePath () + "\" " ,
228- "magisk --install-module \" " + file .getAbsolutePath () + "\" " )
229- .to (installerController , installerMonitor );
230- }
231- } else {
232- File installScript = this .extractInstallScript ("module_installer_compat.sh" );
233- if (installScript == null ) {
234- this .setInstallStateFinished (false ,
235- "! Failed to extract module install script" , "" );
236- return ;
244+ installCommand ).to (installerController , installerMonitor );
237245 }
238- installerMonitor = new InstallerMonitor (installScript );
239- installJob = Shell .su ("export MMM_EXT_SUPPORT=1" ,
240- "export MMM_USER_LANGUAGE=" + (MainApplication .isForceEnglish () ?
241- "en-US" : Resources .getSystem ()
242- .getConfiguration ().locale .toLanguageTag ()),
243- "export MMM_APP_VERSION=" + BuildConfig .VERSION_NAME ,
244- "export MMM_TEXT_WRAP=" + (this .textWrap ? "1" : "0" ),
245- "cd \" " + this .moduleCache .getAbsolutePath () + "\" " ,
246- "sh \" " + installScript .getAbsolutePath () + "\" " +
247- " /dev/null 1 \" " + file .getAbsolutePath () + "\" " )
248- .to (installerController , installerMonitor );
249246 }
250247 boolean success = installJob .exec ().isSuccess ();
251248 // Wait one UI cycle before disabling controller or processing results
0 commit comments