update installer to get PLUTO binaries from assets

This commit is contained in:
Nathan Freitas 2015-12-16 10:27:06 -05:00
parent 7d213e24d4
commit bb55557b44
1 changed files with 10 additions and 9 deletions

View File

@ -69,6 +69,11 @@ public class TorResourceInstaller implements TorServiceConstants {
InputStream is;
File outFile;
String cpuPath = "armeabi";
if (Build.CPU_ABI.contains("x86"))
cpuPath = "x86";
deleteDirectory(installFolder);
installFolder.mkdirs();
@ -85,27 +90,23 @@ public class TorResourceInstaller implements TorServiceConstants {
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, false);
String cpuPath = null;
//only install if ARM (GoLang only supports ARM for now)
if (Build.CPU_ABI.contains("arm"))
if (cpuPath.equals("armeabi"))
{
is = context.getResources().openRawResource(R.raw.obfs4proxy);
cpuPath = "armeabi";
is = context.getAssets().open(cpuPath + "/" + OBFSCLIENT_ASSET_KEY + ".mp3");
outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
setExecutable(outFile);
is = context.getResources().openRawResource(R.raw.meek);
is = context.getAssets().open(cpuPath + "/" + MEEK_ASSET_KEY + ".mp3");
outFile = new File(installFolder, MEEK_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
setExecutable(outFile);
cpuPath = "armeabi";
}
else if (Build.CPU_ABI.contains("x86"))
cpuPath = "x86";
is = context.getAssets().open(cpuPath + "/tor.mp3");
outFile = new File(installFolder, TOR_ASSET_KEY);