1
+ # ### Output functions
2
+ function Err ($str )
3
+ {
4
+ Write-Host " Error | " - foregroundcolor " red" - NoNewline
5
+ Write-Host " $str "
6
+ }
7
+ function Info ($str )
8
+ {
9
+ Write-Host " Info | " - foregroundcolor " green" - NoNewline
10
+ Write-Host " $str "
11
+ }
12
+ function ExitMsg ()
13
+ {
14
+ Err(" Something went wrong while making the offline installer. Elixir was not installed to your computer." )
15
+ Err(" You can report this issue at https://github.com/chyndman/elixir-windows-setup/issues" )
16
+ Write-Host " " - NoNewline
17
+ pause
18
+ exit
19
+ }
20
+
21
+ # ### Initializations
22
+ $cd = (Get-Item - Path " .\" - Verbose).FullName
23
+ $isccDefine = " "
24
+ $isccDir = (Get-Item - Path " .\" - Verbose).FullName
25
+ $elixirVersion = " "
26
+
27
+ # ### Script
28
+ Info(" Current directory:" )
29
+ Info(" $cd " )
30
+
31
+ Info(" Reading arguments..." )
32
+ foreach ($arg in $args )
33
+ {
34
+ Info(" $arg " )
35
+ if ($arg = " --innoelixirweb" )
36
+ {
37
+ $isccDefine = " /dSkipPages /dNoCompression"
38
+ }
39
+ }
40
+ Info(" Finished reading arguments" )
41
+
42
+ Info(" Checking for ISCC.exe in $isccDir ..." )
43
+ if (Test-Path $isccDir \ISCC.exe )
44
+ {
45
+ Info(" ISCC path: $isccDir \ISCC.exe" )
46
+ }
47
+ else
48
+ {
49
+ Err(" ISCC.exe not found in $isccDir " )
50
+ ExitMsg
51
+ }
52
+
53
+ Info(" Checking for elixir directory..." )
54
+ if (Test-Path .\elixir)
55
+ {
56
+ Info(" elixir directory exists" )
57
+ }
58
+ else
59
+ {
60
+ Info(" Not found, checking for Precompiled.zip..." )
61
+ if (Test-Path .\Precompiled.zip)
62
+ {
63
+ Info(" Precompiled.zip found" )
64
+ $zipPath = .\Precompiled.zip
65
+ $zipDest = .\elixir
66
+
67
+ Info(" Creating $zipDest ..." )
68
+ New-Item $zipDest - type directory - force
69
+
70
+ Info(" Extracting files into $zipDest ..." )
71
+ $shell = New-Object - com Shell.Application
72
+ $zipFile = $shell.NameSpace ($zipPath )
73
+ foreach ($item in $zipFile.items ())
74
+ {
75
+ $shell.Namespace ($zipDest ).copyhere($item )
76
+ }
77
+ }
78
+ else
79
+ {
80
+ Err(" Precompiled.zip not found" )
81
+ ExitMsg
82
+ }
83
+ }
84
+
85
+ if ($elixirVersion -eq " " )
86
+ {
87
+ Info(" Reading Elixir version from elixir\VERSION..." )
88
+ $versionFile = Get-Content .\elixir\VERSION
89
+ $elixirVersion = $versionFile [0 ]
90
+ Info(" Elixir version: $elixirVersion " )
91
+ }
92
+
93
+ $isccDefine += " /dElixirVersion=" + $elixirVersion
94
+
95
+ Info(" Running $iscc $isccDefine Elixir.iss" )
96
+ & $iscc $isccDefine Elixir.iss
97
+ if ($LastExitCode -eq 0 )
98
+ {
99
+ Info(" Installer compiled successfully to .\Output" )
100
+ }
101
+ else
102
+ {
103
+ Err(" ISCC.exe failed with exit code $LastExitCode " )
104
+ ExitMsg
105
+ }
0 commit comments