diff --git a/external/.tx/config b/external/.tx/config index 7cec3735..efc0cc8f 100644 --- a/external/.tx/config +++ b/external/.tx/config @@ -8,3 +8,9 @@ host = https://www.transifex.com source_file = ../res/values/strings.xml source_lang = en +[orbot.DESCRIPTION] +file_filter=../docs/play/description-.txt +host = https://www.transifex.com +source_file = ../docs/play/description.txt +source_lang = en + diff --git a/src/org/torproject/android/service/TorResourceInstaller.java b/src/org/torproject/android/service/TorResourceInstaller.java index ff1f2b0b..d17cd703 100644 --- a/src/org/torproject/android/service/TorResourceInstaller.java +++ b/src/org/torproject/android/service/TorResourceInstaller.java @@ -37,6 +37,25 @@ public class TorResourceInstaller implements TorServiceConstants { this.context = context; } + public void deleteDirectory(File file) { + if( file.exists() ) { + if (file.isDirectory()) { + File[] files = file.listFiles(); + for(int i=0; i(),installFolder.getAbsolutePath()); is = context.getResources().openRawResource(R.raw.torrc); outFile = new File(installFolder, TORRC_ASSET_KEY); - shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish(); + shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, false); is = context.getResources().openRawResource(R.raw.torrctether); outFile = new File(installFolder, TORRC_TETHER_KEY); - shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish(); + shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is, outFile, false, false); is = context.getResources().openRawResource(R.raw.privoxy_config); outFile = new File(installFolder, PRIVOXYCONFIG_ASSET_KEY); - shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish(); + shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, false); is = context.getResources().openRawResource(R.raw.tor); outFile = new File(installFolder, TOR_ASSET_KEY); - shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish(); + shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, true); is = context.getResources().openRawResource(R.raw.privoxy); outFile = new File(installFolder, PRIVOXY_ASSET_KEY); - shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish(); + shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, true); is = context.getResources().openRawResource(R.raw.obfsproxy); outFile = new File(installFolder, OBFSPROXY_ASSET_KEY); - shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish(); + shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, true); is = context.getResources().openRawResource(R.raw.xtables); outFile = new File(installFolder, IPTABLES_ASSET_KEY); - shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish(); + shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, true); return true; @@ -136,8 +157,7 @@ public class TorResourceInstaller implements TorServiceConstants { int bytecount; - - OutputStream stmOut = new FileOutputStream(outFile, append); + OutputStream stmOut = new FileOutputStream(outFile.getAbsolutePath(), append); ZipInputStream zis = null; if (zip) diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index ae545934..9382fe2e 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -270,6 +270,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst */ public int onStartCommand(Intent intent, int flags, int startId) { + appBinHome = getDir(DIRECTORY_TOR_BINARY,Application.MODE_PRIVATE); appCacheHome = getDir(DIRECTORY_TOR_DATA,Application.MODE_PRIVATE); @@ -517,11 +518,15 @@ public class TorService extends Service implements TorServiceConstants, TorConst SharedPreferences prefs = getSharedPrefs(getApplicationContext()); String version = prefs.getString(PREF_BINARY_TOR_VERSION_INSTALLED,null); + + logNotice("checking binary version: " + version); if (version == null || (!version.equals(BINARY_TOR_VERSION))) { stopTor(); + logNotice("upgrading binaries to latest version: " + BINARY_TOR_VERSION); + TorResourceInstaller installer = new TorResourceInstaller(this, appBinHome); boolean success = installer.installResources(); @@ -531,6 +536,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst else if (!fileTorRc.exists()) { stopTor(); + + logNotice("upgrading binaries to latest version: " + BINARY_TOR_VERSION); TorResourceInstaller installer = new TorResourceInstaller(this, appBinHome); boolean success = installer.installResources(); diff --git a/src/org/torproject/android/service/TorServiceConstants.java b/src/org/torproject/android/service/TorServiceConstants.java index 321207bd..f11315dc 100644 --- a/src/org/torproject/android/service/TorServiceConstants.java +++ b/src/org/torproject/android/service/TorServiceConstants.java @@ -7,7 +7,7 @@ public interface TorServiceConstants { public final static String TOR_APP_USERNAME = "org.torproject.android"; public final static String ORWEB_APP_USERNAME = "info.guardianproject.browser"; - public final static String DIRECTORY_TOR_BINARY = "bins"; + public final static String DIRECTORY_TOR_BINARY = "bin"; public final static String DIRECTORY_TOR_DATA = "data"; //name of the tor C binary @@ -79,10 +79,10 @@ public interface TorServiceConstants { public static final int DISABLE_TOR_MSG = 3; public static final int LOG_MSG = 4; - public static final String BINARY_TOR_VERSION = "0.2.4.21-openssl1.0.1g-installfix"; + public static final String BINARY_TOR_VERSION = "0.2.4.21-openssl1.0.1g-if6"; public static final String BINARY_PRIVOXY_VERSION = "3.0.12"; - public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INTALLED"; - public static final String PREF_BINARY_PRIVOXY_VERSION_INSTALLED = "BINARY_PRIVOXY_VERSION_INTALLED"; + public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INSTALLED"; + public static final String PREF_BINARY_PRIVOXY_VERSION_INSTALLED = "BINARY_PRIVOXY_VERSION_INSTALLED"; //obfsproxy public static final String OBFSPROXY_ASSET_KEY = "obfsproxy";