Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f9771adce | ||
|
|
b34f60b1b0 | ||
|
|
0fe608f91e | ||
|
|
5d911ef93f | ||
|
|
1d06ff9bf0 | ||
|
|
107927f5a1 | ||
|
|
d6eb5e3511 |
@@ -62,10 +62,21 @@ final class TermuxInstaller {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String PREFIX_FILE_PATH = TermuxConstants.TERMUX_PREFIX_DIR_PATH;
|
||||||
final File PREFIX_FILE = TermuxConstants.TERMUX_PREFIX_DIR;
|
final File PREFIX_FILE = TermuxConstants.TERMUX_PREFIX_DIR;
|
||||||
if (PREFIX_FILE.isDirectory()) {
|
|
||||||
whenDone.run();
|
// If prefix directory exists, even if its a symlink to a valid directory and symlink is not broken/dangling
|
||||||
return;
|
if (FileUtils.directoryFileExists(PREFIX_FILE_PATH, true)) {
|
||||||
|
File[] PREFIX_FILE_LIST = PREFIX_FILE.listFiles();
|
||||||
|
// If prefix directory is empty or only contains the tmp directory
|
||||||
|
if(PREFIX_FILE_LIST == null || PREFIX_FILE_LIST.length == 0 || (PREFIX_FILE_LIST.length == 1 && TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH.equals(PREFIX_FILE_LIST[0].getAbsolutePath()))) {
|
||||||
|
Logger.logInfo(LOG_TAG, "The prefix directory \"" + PREFIX_FILE_PATH + "\" exists but is empty or only contains the tmp directory.");
|
||||||
|
} else {
|
||||||
|
whenDone.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (FileUtils.fileExists(PREFIX_FILE_PATH, false)) {
|
||||||
|
Logger.logInfo(LOG_TAG, "The prefix directory \"" + PREFIX_FILE_PATH + "\" does not exist but another file exists at its destination.");
|
||||||
}
|
}
|
||||||
|
|
||||||
final ProgressDialog progress = ProgressDialog.show(activity, null, activity.getString(R.string.bootstrap_installer_body), true, false);
|
final ProgressDialog progress = ProgressDialog.show(activity, null, activity.getString(R.string.bootstrap_installer_body), true, false);
|
||||||
@@ -80,12 +91,19 @@ final class TermuxInstaller {
|
|||||||
final String STAGING_PREFIX_PATH = TermuxConstants.TERMUX_STAGING_PREFIX_DIR_PATH;
|
final String STAGING_PREFIX_PATH = TermuxConstants.TERMUX_STAGING_PREFIX_DIR_PATH;
|
||||||
final File STAGING_PREFIX_FILE = new File(STAGING_PREFIX_PATH);
|
final File STAGING_PREFIX_FILE = new File(STAGING_PREFIX_PATH);
|
||||||
|
|
||||||
errmsg = FileUtils.clearDirectory(activity, "prefix staging directory", STAGING_PREFIX_PATH);
|
// Delete prefix staging directory or any file at its destination
|
||||||
|
errmsg = FileUtils.deleteFile(activity, "prefix staging directory", STAGING_PREFIX_PATH, true);
|
||||||
if (errmsg != null) {
|
if (errmsg != null) {
|
||||||
throw new RuntimeException(errmsg);
|
throw new RuntimeException(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.logInfo(LOG_TAG, "Extracting bootstrap zip to prefix staging directory \"" + TermuxConstants.TERMUX_STAGING_PREFIX_DIR_PATH + "\".");
|
// Delete prefix directory or any file at its destination
|
||||||
|
errmsg = FileUtils.deleteFile(activity, "prefix directory", PREFIX_FILE_PATH, true);
|
||||||
|
if (errmsg != null) {
|
||||||
|
throw new RuntimeException(errmsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.logInfo(LOG_TAG, "Extracting bootstrap zip to prefix staging directory \"" + STAGING_PREFIX_PATH + "\".");
|
||||||
|
|
||||||
final byte[] buffer = new byte[8096];
|
final byte[] buffer = new byte[8096];
|
||||||
final List<Pair<String, String>> symlinks = new ArrayList<>(50);
|
final List<Pair<String, String>> symlinks = new ArrayList<>(50);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public final class TermuxService extends Service implements TermuxTask.TermuxTas
|
|||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
Logger.logVerbose(LOG_TAG, "onDestroy");
|
Logger.logVerbose(LOG_TAG, "onDestroy");
|
||||||
|
|
||||||
ShellUtils.clearTermuxTMPDIR(this);
|
ShellUtils.clearTermuxTMPDIR(this, true);
|
||||||
|
|
||||||
actionReleaseWakeLock(false);
|
actionReleaseWakeLock(false);
|
||||||
if (!mWantsToStop)
|
if (!mWantsToStop)
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
org.gradle.jvmargs=-Xmx2048M
|
org.gradle.jvmargs=-Xmx2048M
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
|
||||||
termuxVersion=0.110
|
termuxVersion=0.111
|
||||||
termuxVersionCode=110
|
termuxVersionCode=111
|
||||||
|
|
||||||
minSdkVersion=24
|
minSdkVersion=24
|
||||||
targetSdkVersion=28
|
targetSdkVersion=28
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -150,7 +150,10 @@ public class ShellUtils {
|
|||||||
return (lastSlash == -1) ? executable : executable.substring(lastSlash + 1);
|
return (lastSlash == -1) ? executable : executable.substring(lastSlash + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearTermuxTMPDIR(Context context) {
|
public static void clearTermuxTMPDIR(Context context, boolean onlyIfExists) {
|
||||||
|
if(onlyIfExists && !FileUtils.directoryFileExists(TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH, false))
|
||||||
|
return;
|
||||||
|
|
||||||
String errmsg;
|
String errmsg;
|
||||||
errmsg = FileUtils.clearDirectory(context, "$TMPDIR", FileUtils.getCanonicalPath(TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH, null, false));
|
errmsg = FileUtils.clearDirectory(context, "$TMPDIR", FileUtils.getCanonicalPath(TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH, null, false));
|
||||||
if (errmsg != null) {
|
if (errmsg != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user