You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2015/09/08 09:32:10 UTC
karaf git commit: [KARAF-3978]enable specify different
shell.init.script env for remote shell in exec and shell mode
Repository: karaf
Updated Branches:
refs/heads/karaf-2.x 1561ce085 -> 7f00332c0
[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/7f00332c
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/7f00332c
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/7f00332c
Branch: refs/heads/karaf-2.x
Commit: 7f00332c0e5269f538fc7216f5d0d7e54cbdb3ea
Parents: 1561ce0
Author: Freeman Fang <fr...@gmail.com>
Authored: Tue Sep 8 15:31:52 2015 +0800
Committer: Freeman Fang <fr...@gmail.com>
Committed: Tue Sep 8 15:31:52 2015 +0800
----------------------------------------------------------------------
.../org/apache/karaf/shell/ssh/ShellCommandFactory.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/7f00332c/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
index 2f227fc..99ba302 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/ShellCommandFactory.java
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
public class ShellCommandFactory implements CommandFactory {
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(ShellCommandFactory.class);
@@ -120,7 +121,10 @@ public class ShellCommandFactory implements CommandFactory {
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, commandSession);
return commandSession.execute(command);
}
@@ -129,7 +133,10 @@ public class ShellCommandFactory implements CommandFactory {
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, commandSession);
result = commandSession.execute(command);
}