Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/soas-emu.nsi
blob: 41315fbb938bbaf88a7228ce57dab6c620d98cf9 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
; @name         Sugar on a Stick: Emulation
; @version      0-UNREL
; @author       Luke Faraone <luke@faraone.cc>


;Includes and vars

  !include "MUI2.nsh"
  !include LogicLib.nsh

  !define VBX_URL "http://download.virtualbox.org/virtualbox/2.1.4/VirtualBox-2.1.4-42893-Win_x86.msi"

;General

  ;Name and file
  Name "Sugar on a Stick: Emulation"
  OutFile "soas-emu.exe"

  ;Default installation folder
  InstallDir "$PROGRAMFILES32\SoaS-emu" ; is there a good reason to use the 32bit folder as opposed to x64?
  
  ;Request application "root" privileges for Windows 6.0+
  RequestExecutionLevel admin

;--------------------------------
;Interface Settings

  !define MUI_ABORTWARNING
;--------------------------------
; Macros

Function GetVBX
        MessageBox MB_OK "You selected to install VirtualBox, \
                         it will now be downloaded and installed."
 
        StrCpy $2 "$TEMP\vbox.msi"
        nsisdl::download /TIMEOUT=30000 ${VBX_URL} $2
        Pop $R0 ;Get the return value
                StrCmp $R0 "success" +3
                MessageBox MB_OK "Download failed: $R0"
                Quit
        ExecWait $2
        Delete $2
FunctionEnd
 
 
Function DetectVBX
  ReadRegStr $2 HKLM "SOFTWARE\Sun\xVM VirtualBox" \
             "Version"
  ${If} $2 == "" 
  Call GetVBX
  ${EndIf}
 
  done:
FunctionEnd


;--------------------------------
;Pages

  !insertmacro MUI_PAGE_LICENSE "LICENSE.components"
  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  
  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  
;--------------------------------
;Languages
 
  !insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections


Section "Sugar disk image" 

  SetOutPath "$INSTDIR"
  
  ;ADD YOUR OWN FILES HERE...
  File "soas.img"
  AddSize 300000 ; more or less
  ;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

Section "VirtualBox Virtual Machine" 

  AddSize 75000
  Call DetectVBX 

SectionEnd
;--------------------------------
;Descriptions

  ;Language strings
  LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

  ;Assign language strings to sections
  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
  !insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

  ;ADD YOUR OWN FILES HERE...

  Delete "$INSTDIR\Uninstall.exe"

  RMDir "$INSTDIR"

  DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd