/**************************************************************************** ** ** Copyright (C) 2024 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the release tools of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // constructor function Component() { } Component.prototype.createOperations = function() { component.createOperations(); const licenseServiceInstallationPath = "Tools/LicenseService_preview"; // Todo: This should origin via API discovery in future const productionCloudUrl = "https://qls.qt.io"; // [1] Patch the production server address in the qtlicd.ini file var qtlicdConfSrcPath = installer.value("TargetDir") + "/" + licenseServiceInstallationPath + "/qtlicd.ini"; component.addOperation("LineReplace", qtlicdConfSrcPath, "server_addr=", "server_addr=" + productionCloudUrl); // Workaround for [QLS-886] - patch the CA path to remove redundant quotation marks from the value // TODO: can be removed after fixed to config file skeleton component.addOperation("LineReplace", qtlicdConfSrcPath, "ca_bundle_path=", "ca_bundle_path=auto"); // [2] Move the qtlicd.ini file in place var qtlicdConfDstPath = QDesktopServices.storageLocation(QDesktopServices.AppDataLocation); // QDesktopServices concatenates "" into the path, which we want to remove qtlicdConfDstPath = qtlicdConfDstPath.substring(0, qtlicdConfDstPath.lastIndexOf("/")); qtlicdConfDstPath += "/Qt/qtlicd/qtlicd.ini"; var qtlicdConfDstFolder = qtlicdConfDstPath.substring(0, qtlicdConfDstPath.lastIndexOf("/")); if (installer.value("os") == "win") { var windir = installer.environmentVariable("WINDIR"); var cmdLocation = windir + "\\system32\\cmd.exe"; qtlicdConfDstFolder = installer.toNativeSeparators(qtlicdConfDstFolder); qtlicdConfDstPath = installer.toNativeSeparators(qtlicdConfDstPath); qtlicdConfSrcPath = installer.toNativeSeparators(qtlicdConfSrcPath); component.addOperation("Execute", "{0,1}", cmdLocation, "/C", "mkdir", qtlicdConfDstFolder); component.addOperation("Execute", "{0}", cmdLocation, "/C", "move", "/y", qtlicdConfSrcPath, qtlicdConfDstPath); } else if (installer.value("os") == "mac") { component.addOperation("Execute", "{0}", "mkdir", "-p", qtlicdConfDstFolder); component.addOperation("Execute", "{0}", "mv", qtlicdConfSrcPath, qtlicdConfDstPath); } else if (installer.value("os") == "x11" ) { component.addOperation("Execute", "{0}", "mkdir", "-p", qtlicdConfDstFolder); component.addOperation("Execute", "{0}", "mv", qtlicdConfSrcPath, qtlicdConfDstPath); } // [3] Register the qtlicd(.exe) location in the installations.ini file (next to qtlicd.ini file) var qtlicdBinPath = installer.value("TargetDir") + "/" + licenseServiceInstallationPath + "/qtlicd"; if (installer.value("os") == "win") { qtlicdBinPath = installer.toNativeSeparators(qtlicdBinPath); qtlicdBinPath += ".exe"; } component.addOperation("Execute", [qtlicdBinPath, // path of the Service executable "--register", // command to register itself's location in the installations.ini file "installer", // optional: source of the registration, i.e. the "Qt Installer" in this case "--add-key-value", "preview=true", "UNDOEXECUTE", "{0}", qtlicdBinPath, "--unregister" // remove it's location from the installations.ini when uninstalling ]); }