mirror of
				https://github.com/fankes/termux-app.git
				synced 2025-10-25 05:09:20 +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,30 +256,13 @@ 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()) { |  | ||||||
|                 try { |  | ||||||
|                     File canonicalFile = shell.getCanonicalFile(); |  | ||||||
|                     if (canonicalFile.isFile() && canonicalFile.canExecute()) { |  | ||||||
|                         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); |                 File shellFile = new File(PREFIX_PATH + "/bin/" + shellBinary); | ||||||
|                 if (shellFile.canExecute()) { |                 if (shellFile.canExecute()) { | ||||||
|                     executablePath = shellFile.getAbsolutePath(); |                     executablePath = shellFile.getAbsolutePath(); | ||||||
|                     break; |                     break; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             } |  | ||||||
|  |  | ||||||
|             if (executablePath == null) { |             if (executablePath == null) { | ||||||
|                 // Fall back to system shell as last resort: |                 // Fall back to system shell as last resort: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user