mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 11:09:49 +08:00
Launch $PREFIX/bin/login by default
The login command takes care of both showing the etc/motd and launching the login shell.
This commit is contained in:
@@ -24,7 +24,6 @@ import com.termux.terminal.TerminalSession;
|
|||||||
import com.termux.terminal.TerminalSession.SessionChangedCallback;
|
import com.termux.terminal.TerminalSession.SessionChangedCallback;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -257,28 +256,11 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||||||
boolean isLoginShell = false;
|
boolean isLoginShell = false;
|
||||||
|
|
||||||
if (executablePath == null) {
|
if (executablePath == null) {
|
||||||
File shell = new File(HOME_PATH, ".termux/shell");
|
for (String shellBinary : new String[]{"login", "bash", "zsh"}) {
|
||||||
if (shell.exists()) {
|
File shellFile = new File(PREFIX_PATH + "/bin/" + shellBinary);
|
||||||
try {
|
if (shellFile.canExecute()) {
|
||||||
File canonicalFile = shell.getCanonicalFile();
|
executablePath = shellFile.getAbsolutePath();
|
||||||
if (canonicalFile.isFile() && canonicalFile.canExecute()) {
|
break;
|
||||||
executablePath = canonicalFile.getName().equals("busybox") ? (PREFIX_PATH + "/bin/ash") : canonicalFile.getAbsolutePath();
|
|
||||||
} else {
|
|
||||||
Log.w(EmulatorDebug.LOG_TAG, "$HOME/.termux/shell points to non-executable shell: " + canonicalFile.getAbsolutePath());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(EmulatorDebug.LOG_TAG, "Error checking $HOME/.termux/shell", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (executablePath == null) {
|
|
||||||
// Try bash, zsh and ash in that order:
|
|
||||||
for (String shellBinary : new String[]{"bash", "zsh", "ash"}) {
|
|
||||||
File shellFile = new File(PREFIX_PATH + "/bin/" + shellBinary);
|
|
||||||
if (shellFile.canExecute()) {
|
|
||||||
executablePath = shellFile.getAbsolutePath();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user