Repository: karaf Updated Branches: refs/heads/master 6cb8d0997 -> 42c424fde
[KARAF-3978]enable specify different shell.init.script env for remote shell in exec and shell mode Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/42c424fd Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/42c424fd Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/42c424fd Branch: refs/heads/master Commit: 42c424fdeabdc229319291c167d360044870180d Parents: 6cb8d09 Author: Freeman Fang <[email protected]> Authored: Wed Sep 9 13:55:45 2015 +0800 Committer: Freeman Fang <[email protected]> Committed: Wed Sep 9 13:55:45 2015 +0800 ---------------------------------------------------------------------- .../java/org/apache/karaf/shell/ssh/ShellCommand.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/42c424fd/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java ---------------------------------------------------------------------- diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java index dfc3f7d..f85ec3a 100644 --- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java +++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommand.java @@ -49,6 +49,7 @@ import org.slf4j.LoggerFactory; public class ShellCommand implements Command, Runnable, SessionAware { public static final String SHELL_INIT_SCRIPT = "karaf.shell.init.script"; + public static final String EXEC_INIT_SCRIPT = "karaf.exec.init.script"; private static final Logger LOGGER = LoggerFactory.getLogger(ShellCommand.class); @@ -111,7 +112,10 @@ public class ShellCommand implements Command, Runnable, SessionAware { try { result = JaasHelper.doAs(subject, new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { - String scriptFileName = System.getProperty(SHELL_INIT_SCRIPT); + String scriptFileName = System.getProperty(EXEC_INIT_SCRIPT); + if (scriptFileName == null) { + scriptFileName = System.getProperty(SHELL_INIT_SCRIPT); + } executeScript(scriptFileName, session); return session.execute(command); } @@ -120,7 +124,10 @@ public class ShellCommand implements Command, Runnable, SessionAware { throw e.getException(); } } else { - String scriptFileName = System.getProperty(SHELL_INIT_SCRIPT); + String scriptFileName = System.getProperty(EXEC_INIT_SCRIPT); + if (scriptFileName == null) { + scriptFileName = System.getProperty(SHELL_INIT_SCRIPT); + } executeScript(scriptFileName, session); result = session.execute(command); }
