コード例 #1
0
void LibreOffice::build(NSIS *installer, Version version)
{
    isError = false;
    download(version);
    if (!isError) {
        QStringList files(tempFiles);

        QStringList msiOptions("ADDLOCAL=ALL");
        QStringList removeComponents;

        if (!getConfig("Use automatic update", true).toBool()) {
            removeComponents << "gm_o_Onlineupdate";
        }

        if (!removeComponents.isEmpty()) {
            msiOptions << "REMOVE=" + removeComponents.join(",");
        }

        msiOptions << QString("CREATEDESKTOPLINK=%1").arg(getConfig("Desktop shortcut", false).toBool());
        msiOptions << QString("QUICKSTART=%1").arg(getConfig("Enable Quickstarter by default", false).toBool());

        qDebug() << "MSI options:" << msiOptions;

        QString src(loadResource(":NSIS/LibreOffice/main.nsh"));
        src.replace("${MsiFile}", QFileInfo(tempFiles.first()).fileName());
        src.replace("${MsiOptions}", msiOptions.join(" "));

        // Use configuration template if configured
        QString configTemplate(getConfig("Configuration template").toString());
        if (!configTemplate.isEmpty()) {
            QFileInfo file(configTemplate);
            if (file.isReadable()) {
                files << configTemplate;
                src += loadResource(":NSIS/LibreOffice/configtemplate.nsh")
                        .replace("${ConfigTemplate}", file.fileName())
                        .replace("${ShortVersion}", version.truncate(2))
                        ;
            } else {
                Application::critical(tr("The configuration template '%1' cannot be read.").arg(configTemplate));
                isError = true;
            }
        }

        if (!isError) {
            installer->build(
                        objectName(),
                        getOutputFile(),
                        NSIS::Zlib,
                        800,
                        QStringList() << "soffice.exe" << "soffice.bin",
                        files,
                        src
                        );
        }
    }
    cleanup();
}
コード例 #2
0
void AdobeReader::build(NSIS *installer, Version version)
{
    isError = false;
    download(version);
    if (!isError) {
        // Compose options for msiexec command line
        QStringList msiOptions;
        if (getConfig("Suppress reboot", false).toBool()) {
            msiOptions << "REBOOT=ReallySuppress";
        }
        if (getConfig("Accept EULA", false).toBool()) {
            msiOptions << "EULA_ACCEPT=YES";
        }
        if (!getConfig("Desktop shortcut", true).toBool()) {
            msiOptions << "DISABLEDESKTOPSHORTCUT=1";
        }
        if (getConfig("Set default PDF viewer", false).toBool()) {
            msiOptions << "IW_DEFAULT_VERB=READ";
            msiOptions << "LEAVE_PDFOWNERSHIP=NO";
        } else {
            msiOptions << "LEAVE_PDFOWNERSHIP=YES";
        }
        if (!getConfig("Install synchronizer", true).toBool()) {
            msiOptions << "SYNCHRONIZER=NO";
        }
        if (!getConfig("Use automatic update", true).toBool()) {
            msiOptions << "DISABLE_ARM_SERVICE_INSTALL=1";
        }
        qDebug() << "MSI options:" << msiOptions;

        // Compose main installation routine
        Version msiVersion(version.truncate(2).pad(2));
        QString src(loadResource(":NSIS/AdobeReader/main.nsh"));
        src.replace("${VersionMajor}", msiVersion.part(1));
        src.replace("${VersionMinor}", msiVersion.part(2));
        src.replace("${MsiFile}", QFileInfo(msiFile).fileName());
        src.replace("${MsiOptions}", msiOptions.join(" "));

        // Compose patch installation if necessary
        QString header;
        if (!mspFiles.isEmpty()) {
            header = loadResource(":NSIS/AdobeReader/header.nsh");
            QPair<Version, QString> mspFile;
            foreach (mspFile, mspFiles) {
                src += loadResource(":NSIS/AdobeReader/installpatch.nsh")
                        .replace("${MspVersion}", mspFile.first)
                        .replace("${MspFile}", QFileInfo(mspFile.second).fileName())
                        ;
            }