mirror of https://github.com/termux/termux-app
Fix termux-reset
The TMPDIR was being automatically cleared and recreated even if it didn't already exist when TermuxService was stopped. This left an empty TMPDIR in the PREFIX directory when termux-reset was run and on termux restart the bootstrap wasn't installed again because PREFIX directory already existed. This resulted in a broken environment since no binaries/libs existed under PREFIX and /system/bin/sh was loaded. This issue was created due to v0.109.
This commit is contained in:
parent
a6ae656c9f
commit
d6eb5e3511
|
@ -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)
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue