mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-693: Additional improvements
This commit is contained in:
parent
df114d13a6
commit
2a8afd5296
6 changed files with 11 additions and 12 deletions
|
@ -80,14 +80,13 @@ public class ServerAdmin implements GhidraLaunchable {
|
|||
* @param args command line arguments
|
||||
*/
|
||||
public void execute(String[] args) {
|
||||
File serverDir = null;
|
||||
|
||||
int ix = 0;
|
||||
|
||||
String configFilePath = args.length != 0 && !args[0].startsWith("-") ? args[ix++]
|
||||
: System.getProperty(CONFIG_FILE_PROPERTY);
|
||||
|
||||
serverDir = getServerDirFromConfig(configFilePath);
|
||||
File serverDir = getServerDirFromConfig(configFilePath);
|
||||
if (serverDir == null || (args.length - ix) == 0) {
|
||||
displayUsage("");
|
||||
System.exit(-1);
|
||||
|
@ -102,9 +101,7 @@ public class ServerAdmin implements GhidraLaunchable {
|
|||
System.exit(-1);
|
||||
}
|
||||
|
||||
if (propertyUsed) {
|
||||
System.out.println("Using server directory: " + serverDir);
|
||||
}
|
||||
System.out.println("Using server directory: " + serverDir);
|
||||
|
||||
File userFile = new File(serverDir, UserManager.USER_PASSWORD_FILE);
|
||||
if (!serverDir.isDirectory() || !userFile.isFile()) {
|
||||
|
@ -421,6 +418,8 @@ public class ServerAdmin implements GhidraLaunchable {
|
|||
}
|
||||
|
||||
private File getServerDirFromConfig(String configFilePath) {
|
||||
System.out.println("Using config file: " + configFilePath);
|
||||
|
||||
if (configFilePath == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -453,6 +452,7 @@ public class ServerAdmin implements GhidraLaunchable {
|
|||
|
||||
String p = config.getProperty(SERVER_DIR_CONFIG_PROPERTY);
|
||||
if (p == null) {
|
||||
System.out.println("Failed to find property: " + SERVER_DIR_CONFIG_PROPERTY);
|
||||
return null;
|
||||
}
|
||||
File dir = new File(p);
|
||||
|
@ -478,8 +478,8 @@ public class ServerAdmin implements GhidraLaunchable {
|
|||
}
|
||||
String invocationName = System.getProperty(INVOCATION_NAME_PROPERTY);
|
||||
System.err.println("Usage: " +
|
||||
(invocationName != null ? invocationName : "java " + UserAdmin.class.getName()) +
|
||||
(propertyUsed ? "" : " <serverPath>") + " [<command>] [<command>] ...");
|
||||
(invocationName != null ? invocationName : "java " + ServerAdmin.class.getName()) +
|
||||
(invocationName != null ? "" : " <configPath>") + " [<command>] [<command>] ...");
|
||||
System.err.println("\nSupported commands:");
|
||||
System.err.println(" -add <sid> [--p]");
|
||||
System.err.println(
|
||||
|
|
|
@ -45,7 +45,7 @@ fi
|
|||
OWNER="$(grep '^wrapper.app.account=' "${CONFIG}" | sed -e 's/^.*=\(.*\)\s*.*$/\1/')"
|
||||
|
||||
if [ -z "${OWNER}" -o "${OWNER}" = "$(whoami)" ]; then
|
||||
VMARGS="-DUserAdmin.invocation=$(basename "${SCRIPT_FILE}") "
|
||||
VMARGS="-DUserAdmin.invocation=$(basename "${SCRIPT_FILE}")"
|
||||
"${SCRIPT_DIR}"/../support/launch.sh fg svrAdmin "${MAXMEM}" "$VMARGS" ghidra.server.ServerAdmin "${CONFIG}" "$@"
|
||||
else
|
||||
echo "Running svrAdmin with $SUDO as ${OWNER} ..."
|
||||
|
|
|
@ -25,7 +25,7 @@ if [ ! -d "${GHIDRA_ROOT_DIR}" ]; then
|
|||
fi
|
||||
|
||||
# Set required VMARGS for jar builder application
|
||||
APP_VMARGS="-DGhidraJarBuilder.Name=$(basename "${SCRIPT_FILE}") "
|
||||
APP_VMARGS="-DGhidraJarBuilder.Name=$(basename "${SCRIPT_FILE}")"
|
||||
|
||||
# Launch jar builder
|
||||
"${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" Ghidra "${MAXMEM}" "${APP_VMARGS}" ghidra.util.GhidraJarBuilder -main ghidra.JarRun "$@"
|
||||
|
|
|
@ -104,7 +104,6 @@ set ERROR=ERROR: JAVA_HOME is not set and no 'java' command could be found in yo
|
|||
goto reportError
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set "JAVA_HOME=%JAVA_HOME:"=%"
|
||||
set "JAVA=%JAVA_HOME%\bin\java.exe"
|
||||
|
||||
if exist "%JAVA%" goto lab2
|
||||
|
|
|
@ -43,6 +43,6 @@ set "CONFIG=%SCRIPT_DIR%..\..\Common\server\server.conf"
|
|||
|
||||
:continue
|
||||
|
||||
set VMARGS=-DUserAdmin.invocation="%0"
|
||||
set VMARGS=-DUserAdmin.invocation=%~n0
|
||||
|
||||
call "%~dp0\..\support\launch.bat" fg svrAdmin "%MAXMEM%" "%VMARGS%" ghidra.server.ServerAdmin "%CONFIG%" %*
|
||||
|
|
|
@ -18,6 +18,6 @@ exit /B 1
|
|||
|
||||
:continue
|
||||
|
||||
set APP_VMARGS=-DGhidraJarBuilder.Name=%0
|
||||
set APP_VMARGS=-DGhidraJarBuilder.Name=%~n0
|
||||
|
||||
call "%~dp0launch.bat" %LAUNCH_MODE% Ghidra "" "%APP_VMARGS%" ghidra.util.GhidraJarBuilder -main ghidra.JarRun %*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue