Fix fips.sh scripts to work when executed from outside the /bin directory#13897
Fix fips.sh scripts to work when executed from outside the /bin directory#13897
Conversation
|
|
Co-authored-by: HeshanSudarshana <25485783+HeshanSudarshana@users.noreply.github.com>
|
@copilot verify whether the same issue is there for fips.bat file as well |
The fips.bat files do not have the same issue. They already use the correct pattern at line 29: if "%CARBON_HOME%"=="" set CARBON_HOME=%~sdp0..The
This is the Windows equivalent of the fix we applied to the .sh files. All four fips.bat files (gateway, traffic-manager, all-in-one-apim, api-control-plane) already have this correct implementation, matching the pattern used in other .bat startup scripts like gateway.bat and api-cp.bat. Verified: ✓ gateway/fips.bat ✓ traffic-manager/fips.bat ✓ all-in-one-apim/fips.bat ✓ api-control-plane/fips.bat |
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.