Skip to content

Commit

Permalink
chore: Add global bin scripts for pwtool, fcli_completion
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Jan 25, 2024
1 parent 50eee4f commit b841ced
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,15 @@ public final void installGlobalBinScript(GlobalBinScriptType type, String global
var globalBinPath = getGlobalBinPath();
if ( globalBinPath!=null ) {
var resourceFile = ToolInstallationHelper.getToolResourceLocation("extra-files/global-bin/"+type.name());
var destFilePath = globalBinPath.resolve(globalBinScriptName);
FileUtils.copyResource(resourceFile, destFilePath, StandardCopyOption.REPLACE_EXISTING);
String content = new String(Files.readAllBytes(destFilePath), "ASCII");
content = content.replace("{{target}}", getTargetPath().resolve(target).toString());
Files.write(destFilePath, content.getBytes("ASCII"));
ToolInstaller.updateFilePermissions(destFilePath);
var globalBinFilePath = globalBinPath.resolve(globalBinScriptName);
var globalBinTargetFilePath = getTargetPath().resolve(target);
if ( Files.exists(globalBinTargetFilePath) ) {
FileUtils.copyResource(resourceFile, globalBinFilePath, StandardCopyOption.REPLACE_EXISTING);
String content = new String(Files.readAllBytes(globalBinFilePath), "ASCII");
content = content.replace("{{target}}", globalBinTargetFilePath.toString());
Files.write(globalBinFilePath, content.getBytes("ASCII"));
ToolInstaller.updateFilePermissions(globalBinFilePath);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ protected void postInstall(ToolInstaller installer, ToolInstallationResult insta
installer.installGlobalBinScript(GlobalBinScriptType.bat, "fcli.bat", "bin/fcli.bat");
} else {
installer.installGlobalBinScript(GlobalBinScriptType.bash, "fcli", "bin/fcli");
installer.installGlobalBinScript(GlobalBinScriptType.bash, "fcli_completion", "bin/fcli_completion");
installer.installGlobalBinScript(GlobalBinScriptType.bat, "fcli.bat", "bin/fcli.exe");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ protected void postInstall(ToolInstaller installer, ToolInstallationResult insta
updateClientAuthToken(installer.getTargetPath());
installer.installGlobalBinScript(GlobalBinScriptType.bash, "scancentral", "bin/scancentral");
installer.installGlobalBinScript(GlobalBinScriptType.bat, "scancentral.bat", "bin/scancentral.bat");
installer.installGlobalBinScript(GlobalBinScriptType.bash, "pwtool", "bin/pwtool");
installer.installGlobalBinScript(GlobalBinScriptType.bat, "pwtool.bat", "bin/pwtool.bat");
}

private void updateClientAuthToken(Path installPath) throws IOException {
Expand Down

0 comments on commit b841ced

Please sign in to comment.