2024-05-06 15:52:57 +08:00
|
|
|
function cancelInstaller(message)
|
|
|
|
{
|
|
|
|
installer.setDefaultPageVisible(QInstaller.Introduction, false);
|
|
|
|
installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
|
|
|
|
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
|
|
|
|
installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);
|
|
|
|
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
|
|
|
|
installer.setDefaultPageVisible(QInstaller.PerformInstallation, false);
|
|
|
|
installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
|
|
|
|
|
|
|
|
var abortText = "<font color='red'>" + message +"</font>";
|
|
|
|
installer.setValue("FinishedText", abortText);
|
|
|
|
installer.setValue("RunProgram", null);
|
|
|
|
}
|
|
|
|
|
|
|
|
function isSupported()
|
|
|
|
{
|
|
|
|
if (systemInfo.kernelType === "winnt") {
|
|
|
|
var major = parseInt(systemInfo.kernelVersion.split(".", 1));
|
|
|
|
var minor = parseInt(systemInfo.kernelVersion.split(".", 2)[1]);
|
|
|
|
// Windows >= 8.1
|
|
|
|
if (major > 6 || (major == 6 && minor >= 3)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function createShortcuts()
|
|
|
|
{
|
|
|
|
var windir = installer.environmentVariable("WINDIR");
|
|
|
|
if (windir === "") {
|
|
|
|
QMessageBox["warning"]( "Error" , "Error", "Could not find windows installation directory");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-05-17 15:31:02 +08:00
|
|
|
component.addOperation("CreateShortcut", "@TargetDir@/clang64.exe", "@StartMenuDir@/MSYS2 with ARTIQ.lnk", "iconPath=@TargetDir@/clang64.exe");
|
2024-06-24 15:06:18 +08:00
|
|
|
component.addOperation("CreateShortcut", "@TargetDir@/zadig.exe", "@StartMenuDir@/Zadig Driver Installer.lnk", "iconPath=@TargetDir@/zadig.exe");
|
2024-05-06 15:52:57 +08:00
|
|
|
|
|
|
|
component.addOperation( "Execute",
|
|
|
|
["@TargetDir@\\usr\\bin\\bash.exe", "--login", "-c", "exit"]);
|
|
|
|
}
|
|
|
|
|
2024-08-13 16:48:23 +08:00
|
|
|
function postInstall() {
|
|
|
|
component.addOperation( "Execute",
|
|
|
|
["@TargetDir@\\usr\\bin\\bash.exe", "--login", "-c", "pacman -Udd --noconfirm /mingw-w64-clang-x86_64-ca-certificates.pkg.tar.zst && rm /mingw-w64-clang-x86_64-ca-certificates.pkg.tar.zst"]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-05-06 15:52:57 +08:00
|
|
|
function Component() {
|
|
|
|
|
|
|
|
if (!isSupported()) {
|
|
|
|
cancelInstaller("Installation on " + systemInfo.prettyProductName + " is not supported");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var systemDrive = installer.environmentVariable("SystemDrive");
|
|
|
|
// Use C: as a default for messed up systems.
|
|
|
|
if (systemDrive === "") {
|
|
|
|
systemDrive = "C:";
|
|
|
|
}
|
|
|
|
var targetDir = installer.value("TargetDir", systemDrive+"\\msys64")
|
|
|
|
|
|
|
|
installer.setValue("TargetDir", targetDir);
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.prototype.createOperations = function()
|
|
|
|
{
|
|
|
|
component.createOperations();
|
2024-08-13 16:48:23 +08:00
|
|
|
postInstall();
|
2024-05-06 15:52:57 +08:00
|
|
|
createShortcuts();
|
|
|
|
}
|