forked from PhoenicisOrg/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
67 lines (53 loc) · 1.91 KB
/
script.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
include("engines.wine.quick_script.quick_script");
include("utils.functions.net.download");
const Wine = include("engines.wine.engine.object");
include("utils.functions.filesystem.extract");
include("engines.wine.verbs.luna");
class ZipScript extends QuickScript {
constructor() {
super();
}
url(url) {
this._url = url;
return this;
}
checksum(checksum) {
this._checksum = checksum;
return this;
}
go() {
const setupWizard = SetupWizard(InstallationType.APPS, this._name, this.miniature());
setupWizard.presentation(this._name, this._editor, this._applicationHomepage, this._author);
const wine = new Wine()
.wizard(setupWizard)
.prefix(this._name, this._wineDistribution, this._wineArchitecture, this._wineVersion)
.create()
.luna()
.wait();
this._preInstall(wine, setupWizard);
// back to generic wait (might have been changed in preInstall)
setupWizard.wait(tr("Please wait..."));
let archive = "";
if (!this._url) {
archive = setupWizard.browse(tr("Please select the .zip file."), wine.prefixDirectory(), ["zip"]);
} else {
archive = wine.prefixDirectory() + "/drive_c/archive.zip";
new Downloader()
.wizard(setupWizard)
.url(this._url)
.checksum(this._checksum)
.to(archive)
.get();
}
new Extractor()
.wizard(setupWizard)
.archive(archive)
.to(wine.prefixDirectory() + "/drive_c/" + this._name)
.extract();
this._postInstall(wine, setupWizard);
this._createShortcut(wine.prefix());
// back to generic wait (might have been changed in postInstall)
setupWizard.wait(tr("Please wait..."));
setupWizard.close();
}
}