Fix fips.sh scripts to work when executed from outside the /bin directory #13897
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
fips.shscripts in all four modules (gateway, traffic-manager, all-in-one-apim, and api-control-plane) failed when executed from outside their/bindirectory. This was caused by the scripts using the$PRGvariable without initializing it, resulting in incorrectCARBON_HOMEpath calculation.Example of the Issue
When
$PRGis uninitialized:PRGDIRdefaults to.(current directory)CARBON_HOMEis incorrectly calculated as/or the wrong pathSolution
Added the missing PRG variable initialization and symlink resolution logic to all four fips.sh scripts, following the same pattern used in other startup scripts like
gateway.sh,api-cp.sh, andkey-manager.sh:This ensures:
CARBON_HOMEis correctly calculated relative to the script locationChanges
gateway/modules/distribution/product/src/main/startup-scripts/fips.shtraffic-manager/modules/distribution/product/src/main/startup-scripts/fips.shall-in-one-apim/modules/distribution/product/src/main/startup-scripts/fips.shapi-control-plane/modules/distribution/product/src/main/startup-scripts/fips.shTesting
All test scenarios verified:
Impact
Fixes the issue where fips.sh scripts only worked when executed from within the /bin directory.
Original prompt
Fixes wso2/api-manager#4417
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.