No more old module exists
This commit is contained in:
parent
fb40e96917
commit
0893ac3141
@ -25,7 +25,6 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
@ -95,7 +94,7 @@ public class DownloadModuleService extends Service {
|
||||
.setDownloadProgressListener(progress)
|
||||
.execForInputStream().getResult();
|
||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(output));
|
||||
processZip(in, out, repo.isNewInstaller());
|
||||
processZip(in, out);
|
||||
Intent intent = new Intent(this, ClassMap.get(FlashActivity.class));
|
||||
intent.setData(Uri.fromFile(output))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
@ -120,12 +119,11 @@ public class DownloadModuleService extends Service {
|
||||
removeNotification(progress);
|
||||
}
|
||||
|
||||
private void processZip(InputStream in, OutputStream out, boolean inject)
|
||||
private void processZip(InputStream in, OutputStream out)
|
||||
throws IOException {
|
||||
try (ZipInputStream zin = new ZipInputStream(in);
|
||||
ZipOutputStream zout = new ZipOutputStream(out)) {
|
||||
|
||||
if (inject) {
|
||||
// Inject latest module-installer.sh as update-binary
|
||||
zout.putNextEntry(new ZipEntry("META-INF/"));
|
||||
zout.putNextEntry(new ZipEntry("META-INF/com/"));
|
||||
@ -137,8 +135,7 @@ public class DownloadModuleService extends Service {
|
||||
ShellUtils.pump(update_bin, zout);
|
||||
}
|
||||
zout.putNextEntry(new ZipEntry("META-INF/com/google/android/updater-script"));
|
||||
zout.write("#MAGISK\n".getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
zout.write("#MAGISK\n".getBytes("UTF-8"));
|
||||
|
||||
int off = -1;
|
||||
ZipEntry entry;
|
||||
@ -148,7 +145,7 @@ public class DownloadModuleService extends Service {
|
||||
String path = entry.getName().substring(off);
|
||||
if (path.isEmpty())
|
||||
continue;
|
||||
if (inject && path.startsWith("META-INF"))
|
||||
if (path.startsWith("META-INF"))
|
||||
continue;
|
||||
zout.putNextEntry(new ZipEntry(path));
|
||||
if (!entry.isDirectory())
|
||||
|
@ -7,8 +7,6 @@ import android.os.Parcelable;
|
||||
|
||||
import com.topjohnwu.magisk.Const;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
import com.topjohnwu.net.Networking;
|
||||
import com.topjohnwu.net.Request;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
@ -91,18 +89,6 @@ public class Repo extends BaseModule {
|
||||
return String.format(Const.Url.FILE_URL, getId(), file);
|
||||
}
|
||||
|
||||
public boolean isNewInstaller() {
|
||||
try (Request install = Networking.get(getFileUrl("install.sh"))) {
|
||||
if (install.connect().isSuccess()) {
|
||||
// Double check whether config.sh exists
|
||||
try (Request config = Networking.get(getFileUrl("config.sh"))) {
|
||||
return !config.connect().isSuccess();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getLastUpdateString() {
|
||||
return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(mLastUpdate);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user