2019-11-16 15:11:38 +03:00
|
|
|
var VERSION = "1.4"
|
|
|
|
|
|
|
|
function Component()
|
|
|
|
{
|
|
|
|
generateTr();
|
2020-01-22 10:23:17 +03:00
|
|
|
component.addDependency("QIF");
|
2019-11-16 15:11:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function generateTr() {
|
|
|
|
component.setValue("DisplayName", qsTr("CQtDeployer " + VERSION));
|
|
|
|
component.setValue("Description", qsTr("This package contains CQtDeployer version " + VERSION));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Component.prototype.createOperations = function()
|
|
|
|
{
|
|
|
|
// // call default implementation to actually install README.txt!
|
|
|
|
component.createOperations();
|
|
|
|
systemIntegration();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function systemIntegration() {
|
|
|
|
targetDir = installer.value("TargetDir", "");
|
|
|
|
homeDir = installer.value("HomeDir", "");
|
|
|
|
|
|
|
|
console.log("install component")
|
|
|
|
console.log("targetDir " + targetDir)
|
|
|
|
console.log("hometDir " + homeDir)
|
|
|
|
|
|
|
|
if (systemInfo.kernelType === "winnt") {
|
|
|
|
|
|
|
|
component.addOperation('Execute', ["SETX", "cqtdeployer", "\"" + targetDir + "/" + VERSION + "/cqtdeployer.exe\""])
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (!installer.fileExists(homeDir + "/.local/bin")) {
|
|
|
|
|
2019-12-10 12:08:54 +03:00
|
|
|
component.addOperation('Execute', ["mkdir", "-p", homeDir + "/.local/bin"])
|
2019-11-16 15:11:38 +03:00
|
|
|
|
|
|
|
QMessageBox["warning"](qsTr("install in system"), qsTr("Installer"),
|
|
|
|
qsTr("The \"~/local/bin\" folder was not initialized, you may need to reboot to work correctly!"),
|
|
|
|
QMessageBox.Ok);
|
|
|
|
|
2019-12-10 12:08:54 +03:00
|
|
|
var ansver = installer.execute('cat', [homeDir + "/.profile"]);
|
|
|
|
var result;
|
|
|
|
if (ansver.length >= 2) {
|
|
|
|
result = ansver[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!result.includes("/.local/bin")) {
|
|
|
|
|
|
|
|
var script = '\n# set PATH so it includes users private bin if it exists (generated by cqtdeployer installer) \n' +
|
|
|
|
'if [ -d "$HOME/.local/bin" ] ; then \n' +
|
|
|
|
' PATH="$HOME/.local/bin:$PATH" \n' +
|
|
|
|
'fi \n';
|
|
|
|
|
|
|
|
component.addOperation('AppendFile', [homeDir + "/.profile", script])
|
|
|
|
}
|
|
|
|
|
2019-11-16 15:11:38 +03:00
|
|
|
}
|
|
|
|
component.addOperation('Execute', ["ln", "-sf", targetDir + "/" + VERSION + "/cqtdeployer.sh",
|
|
|
|
homeDir + "/.local/bin/cqtdeployer"],
|
|
|
|
"UNDOEXECUTE", ["rm", "-f", homeDir + "/.local/bin/cqtdeployer"] )
|
|
|
|
|
2020-03-10 10:10:24 +03:00
|
|
|
component.addOperation('Execute', ["ln", "-sf", targetDir + "/" + VERSION + "/cqt.sh",
|
|
|
|
homeDir + "/.local/bin/cqt"],
|
|
|
|
"UNDOEXECUTE", ["rm", "-f", homeDir + "/.local/bin/cqt"] )
|
|
|
|
|
2020-03-10 15:45:49 +03:00
|
|
|
component.addOperation('Execute', ["ln", "-sf", targetDir + "/" + VERSION + "/cqt.sh",
|
|
|
|
homeDir + "/.local/bin/cqtdeployer.cqt"],
|
|
|
|
"UNDOEXECUTE", ["rm", "-f", homeDir + "/.local/bin/cqtdeployer.cqt"] )
|
|
|
|
|
2019-11-16 15:11:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|