Minor installer fix.
[LameXP.git] / etc / NSIS / wrapper.nsi
blob1e5f4a83d64fbecf77455e219c29c70e9c42eea6
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // LameXP - Audio Encoder Front-End
3 ; // Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
4 ; //
5 ; // This program is free software; you can redistribute it and/or modify
6 ; // it under the terms of the GNU General Public License as published by
7 ; // the Free Software Foundation; either version 2 of the License, or
8 ; // (at your option) any later version.
9 ; //
10 ; // This program is distributed in the hope that it will be useful,
11 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; // GNU General Public License for more details.
14 ; //
15 ; // You should have received a copy of the GNU General Public License along
16 ; // with this program; if not, write to the Free Software Foundation, Inc.,
17 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 ; //
19 ; // http://www.gnu.org/licenses/gpl-2.0.txt
20 ; ///////////////////////////////////////////////////////////////////////////////
22 ;--------------------------------
23 ;Basic Defines
24 ;--------------------------------
26 !ifndef LAMEXP_VERSION
27 !error "LAMEXP_VERSION is not defined !!!"
28 !endif
29 !ifndef LAMEXP_BUILD
30 !error "LAMEXP_BUILD is not defined !!!"
31 !endif
32 !ifndef LAMEXP_INSTTYPE
33 !error "LAMEXP_INSTTYPE is not defined !!!"
34 !endif
35 !ifndef LAMEXP_PATCH
36 !error "LAMEXP_PATCH is not defined !!!"
37 !endif
38 !ifndef LAMEXP_DATE
39 !error "LAMEXP_DATE is not defined !!!"
40 !endif
41 !ifndef LAMEXP_OUTPUT_FILE
42 !error "LAMEXP_OUTPUT_FILE is not defined !!!"
43 !endif
44 !ifndef LAMEXP_SOURCE_FILE
45 !error "LAMEXP_SOURCE_FILE is not defined !!!"
46 !endif
47 !ifndef LAMEXP_UPX_PATH
48 !error "LAMEXP_UPX_PATH is not defined !!!"
49 !endif
51 ;Web-Site
52 !define MyWebSite "http://mulder.at.gg/"
55 ;--------------------------------
56 ;Includes
57 ;--------------------------------
59 !include `StdUtils.nsh`
62 ;--------------------------------
63 ;Installer Attributes
64 ;--------------------------------
66 XPStyle on
67 RequestExecutionLevel user
68 InstallColors /windows
69 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
70 OutFile "${LAMEXP_OUTPUT_FILE}"
71 BrandingText "${LAMEXP_DATE} / Build #${LAMEXP_BUILD}"
72 Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
73 ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
74 ShowInstDetails show
75 AutoCloseWindow true
76 InstallDir ""
79 ;--------------------------------
80 ;Page Captions
81 ;--------------------------------
83 SubCaption 0 " "
84 SubCaption 1 " "
85 SubCaption 2 " "
86 SubCaption 3 " "
87 SubCaption 4 " "
90 ;--------------------------------
91 ;Compressor
92 ;--------------------------------
94 !packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
97 ;--------------------------------
98 ;Reserved Files
99 ;--------------------------------
101 ReserveFile "${NSISDIR}\Plugins\System.dll"
102 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
105 ;--------------------------------
106 ;Version Info
107 ;--------------------------------
109 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
110 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
112 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
113 VIAddVersionKey "Comments" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version."
114 VIAddVersionKey "CompanyName" "Free Software Foundation"
115 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
116 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
117 VIAddVersionKey "LegalCopyright" "Copyright 2004-2011 LoRd_MuldeR"
118 VIAddVersionKey "LegalTrademarks" "GNU"
119 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
120 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
121 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
122 VIAddVersionKey "Website" "${MyWebSite}"
125 ;--------------------------------
126 ;Installer initialization
127 ;--------------------------------
129 Section "-LaunchTheInstaller"
130 SetDetailsPrint textonly
131 DetailPrint "Launching installer, please stay tuned..."
132 SetDetailsPrint listonly
134 InitPluginsDir
135 SetOutPath "$PLUGINSDIR"
136 File "/oname=$PLUGINSDIR\LameXP-Install.exe" "${LAMEXP_SOURCE_FILE}"
138 ; --------
140 StrCpy $R9 ""
141 ${StdUtils.GetParameter} $R0 "Update" "?"
143 StrCmp "$R0" "?" +5
144 StrCmp "$R0" "" 0 +3
145 StrCpy $R9 "/Update"
146 Goto +2
147 StrCpy $R9 '"/Update=$R0"'
149 StrCmp "$INSTDIR" "" +5
150 StrCmp "$R9" "" 0 +3
151 StrCpy $R9 '/D=$INSTDIR'
152 Goto +2
153 StrCpy $R9 '$R9 /D=$INSTDIR'
155 ; --------
157 RunTryAgain:
159 DetailPrint "ExecShellWait: $PLUGINSDIR\LameXP-Install.exe"
160 ${StdUtils.ExecShellWait} $R1 "$PLUGINSDIR\LameXP-Install.exe" "open" '$R9'
161 DetailPrint "Result: $R1"
163 StrCmp $R1 "error" RunFailed
164 StrCmp $R1 "no_wait" RunSuccess
165 Sleep 333
166 HideWindow
167 ${StdUtils.WaitForProc} $R1
168 Goto RunSuccess
170 ; --------
172 RunFailed:
174 MessageBox MB_RETRYCANCEL|MB_ICONSTOP|MB_TOPMOST "Failed to launch the installer. Please try again!" IDRETRY RunTryAgain
176 ; --------
178 ClearErrors
179 ExecShell "open" "$PLUGINSDIR\LameXP-Install.exe" '$R9' SW_SHOWNORMAL
180 IfErrors 0 RunSuccess
182 ClearErrors
183 ExecShell "" "$PLUGINSDIR\LameXP-Install.exe" '$R9' SW_SHOWNORMAL
184 IfErrors 0 RunSuccess
186 ; --------
188 SetDetailsPrint both
189 DetailPrint "Failed to launch installer :-("
190 SetDetailsPrint listonly
192 ${StdUtils.Unload}
193 Abort "Aborted."
195 ; --------
197 RunSuccess:
199 Delete /REBOOTOK "$PLUGINSDIR\LameXP-Install.exe"
200 ${StdUtils.Unload}
201 SectionEnd