summaryrefslogtreecommitdiff
path: root/installer/packages/riseupvpn/meta/install.js
blob: e5174e171aa305f11406a4fe0793db5e477378e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/****************************************************************************
**
** Copyright (C) 2020 LEAP
**
****************************************************************************/

function Component() {
}

Component.prototype.createOperations = function ()
{
    // This will actually install the files
    component.createOperations();

    // And now our custom actions.
    // See https://doc.qt.io/qtinstallerframework/operations.html for reference
    //
    // We can also use this to register different components (different architecture for instance)
    // See https://doc.qt.io/qtinstallerframework/qt-installer-framework-systeminfo-packages-root-meta-installscript-qs.html

    console.log("Post installation. Checking platform...")
    if (systemInfo.productType === "windows") {
        console.log("Platform: windows");
        postInstallWindows();
    } else if (systemInfo.productType === "osx") {
        console.log("Platform: osx");
        postInstallOSX();
    } else {
        console.log("Platform: linux");
        postInstallLinux();
    }
}

function postInstallWindows() {
    component.addOperation("CreateShortcut",
                   "@TargetDir@/README.txt",
                   "@StartMenuDir@/README.lnk",
                   "workingDirectory=@TargetDir@",
                   "iconPath=%SystemRoot%/system32/SHELL32.dll",
                   "iconId=2");
}

function postInstallOSX() {
    console.log("TODO: should do osx post-installation");
}

function postInstallLinux() {
    console.log("TODO: should do linux post-installation");
    console.log("Maybe you want to use your package manager instead?");
    component.addOperation("AppendFile", "/tmp/riseupvpn.log", "this is a test - written from the installer");
}