Support new sha1 location

This commit is contained in:
topjohnwu 2017-11-03 05:02:14 +08:00
parent a34ed538b6
commit 166469827f

View File

@ -19,10 +19,18 @@ public class RestoreStockBoot extends ParallelTask<Void, Void, Boolean> {
@Override
protected Boolean doInBackground(Void... voids) {
List<String> ret = Shell.su("cat /init.magisk.rc | grep STOCKSHA1");
if (!Utils.isValidShellResponse(ret))
return false;
String stock_boot = "/data/stock_boot_" + ret.get(0).substring(ret.get(0).indexOf('=') + 1) + ".img.gz";
String sha1;
List<String> ret = Utils.readFile("/.backup/.sha1");
if (!Utils.isValidShellResponse(ret)) {
ret = Shell.su("cat /init.magisk.rc | grep STOCKSHA1");
if (!Utils.isValidShellResponse(ret))
return false;
sha1 = ret.get(0).substring(ret.get(0).indexOf('=') + 1);
} else {
sha1 = ret.get(0);
}
String stock_boot = "/data/stock_boot_" + sha1 + ".img.gz";
if (!Utils.itemExist(stock_boot))
return false;
Shell.su_raw("flash_boot_image " + stock_boot + " " + mBoot);