public boolean install() { Logger.debug("Installing tools ..."); // Avoid some binary file being busy as a running process. System.clean(false); ZipInputStream zipInput; ZipEntry zipEntry; byte[] buffer = new byte[BUFFER_SIZE]; int read; FileOutputStream fileOutput; File file; String fileName; try { zipInput = new ZipInputStream(new BufferedInputStream(mAppContext.getAssets().open(TOOLS_FILENAME))); while ((zipEntry = zipInput.getNextEntry()) != null) { fileName = mDestPath + "/" + zipEntry.getName(); file = new File(mDestPath + "/" + zipEntry.getName()); if (zipEntry.isDirectory()) file.mkdirs(); else { fileOutput = new FileOutputStream(fileName); while ((read = zipInput.read(buffer, 0, BUFFER_SIZE)) > -1) { fileOutput.write(buffer, 0, read); } fileOutput.close(); zipInput.closeEntry(); } } zipInput.close(); String cmd = ""; for (String install_cmd : INSTALL_COMMANDS) { cmd += install_cmd.replace("{PATH}", mDestPath + "/tools").replace("{FILES}", mDestPath) + "; "; } Shell.exec(cmd); Shell.exec( "echo '" + mAppVersion + "' > '" + mVersionFile + "' && chmod 777 '" + mVersionFile + "'"); System.reloadTools(); return true; } catch (Exception e) { System.errorLogging(e); return false; } }