From 78127e64ef910e08923113a2e871050a967818b5 Mon Sep 17 00:00:00 2001 From: KeybadeBlox Date: Thu, 12 Feb 2026 16:16:07 -0500 Subject: [PATCH] Arguments via environment variables in delink.sh It was really annoying having to type all that in every time. --- ghidra/delink.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ghidra/delink.sh b/ghidra/delink.sh index 9b14b9b..f374643 100755 --- a/ghidra/delink.sh +++ b/ghidra/delink.sh @@ -3,11 +3,21 @@ # objects.csv and a Ghidra project via boricj's delinker extension main() { - if [ $# -ne 3 ]; then usage; fi - - ghidra_path=$1 - project_path=$2 - project_name=$3 + if \ + [ $# -eq 0 ] &&\ + [ -n "${GHIDRA_HOME-}" ] &&\ + [ -n "${JSRFDECOMP_PROJECTPATH-}" ] &&\ + [ -n "${JSRFDECOMP_PROJECTNAME-}" ] + then + ghidra_path=$GHIDRA_HOME + project_path=$JSRFDECOMP_PROJECTPATH + project_name=$JSRFDECOMP_PROJECTNAME + elif [ $# -eq 3 ]; then + ghidra_path=$1 + project_path=$2 + project_name=$3 + else usage + fi printf '=== Delinking object files into ../decompile/target/ ===\n' @@ -39,6 +49,9 @@ usage() { ' GHIDRA_PATH is the path to your Ghidra installation'\ ' PROJECT_PATH is the path to your JSRF Ghidra project'\ ' PROJECT_NAME is the name of your JSRF Ghidra project'\ + 'Alternatively, the environment variables $GHIDRA_HOME, $JSRFDECOMP_PROJECTPATH,'\ + 'and $JSRFDECOMP_PROJECTNAME can be set, and the script can be called with no'\ + 'arguments.'\ ''\ 'Populates the target/ directory with delinked object files using the address'\ 'ranges given in objects.csv.' >& 2