OSDN Git Service

Slightly changed temporary installer name.
[lamexp/LameXP.git] / etc / NSIS / wrapper.nsi
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // LameXP - Audio Encoder Front-End
3 ; // Copyright (C) 2004-2012 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 ; ///////////////////////////////////////////////////////////////////////////////
21
22 ;--------------------------------
23 ;Basic Defines
24 ;--------------------------------
25
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
50
51 ;Web-Site
52 !define MyWebSite "http://mulder.at.gg/"
53
54
55 ;--------------------------------
56 ;Includes
57 ;--------------------------------
58
59 !include `LogicLib.nsh`
60 !include `StdUtils.nsh`
61
62
63 ;--------------------------------
64 ;Installer Attributes
65 ;--------------------------------
66
67 XPStyle on
68 RequestExecutionLevel user
69 InstallColors /windows
70 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
71 OutFile "${LAMEXP_OUTPUT_FILE}"
72 BrandingText "${LAMEXP_DATE} / Build #${LAMEXP_BUILD}"
73 Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
74 ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
75 ShowInstDetails show
76 AutoCloseWindow true
77 InstallDir ""
78
79
80 ;--------------------------------
81 ;Page Captions
82 ;--------------------------------
83
84 SubCaption 0 " "
85 SubCaption 1 " "
86 SubCaption 2 " "
87 SubCaption 3 " "
88 SubCaption 4 " "
89
90
91 ;--------------------------------
92 ;Compressor
93 ;--------------------------------
94
95 !packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
96
97
98 ;--------------------------------
99 ;Reserved Files
100 ;--------------------------------
101
102 ReserveFile "${NSISDIR}\Plugins\System.dll"
103 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
104
105
106 ;--------------------------------
107 ;Version Info
108 ;--------------------------------
109
110 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
111 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
112
113 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
114 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."
115 VIAddVersionKey "CompanyName" "Free Software Foundation"
116 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
117 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
118 VIAddVersionKey "LegalCopyright" "Copyright 2004-2012 LoRd_MuldeR"
119 VIAddVersionKey "LegalTrademarks" "GNU"
120 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
121 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
122 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
123 VIAddVersionKey "Website" "${MyWebSite}"
124
125
126 ;--------------------------------
127 ;Installer initialization
128 ;--------------------------------
129
130 Section "-LaunchTheInstaller"
131         SetDetailsPrint textonly
132         DetailPrint "Launching installer, please stay tuned..."
133         SetDetailsPrint listonly
134         
135         InitPluginsDir
136         SetOutPath "$PLUGINSDIR"
137         File "/oname=$PLUGINSDIR\LameXP-SETUP.${LAMEXP_DATE}.${LAMEXP_BUILD}.exe" "${LAMEXP_SOURCE_FILE}"
138         
139         ; --------
140         
141         ${If} "$EXEFILE" == "LameXP.exe"
142         ${OrIf} "$EXEFILE" == "LameXP-Portable.exe"
143                 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, you must NOT rename the LameXP installation program to 'LameXP.exe' or 'LameXP-Portable.exe'. Please re-rename the installer executable file (e.g. to 'LameXP-Setup.exe') and then try again!"
144                 Quit
145         ${EndIf}
146
147         ; --------
148
149         ${StdUtils.GetAllParameters} $R9 0
150         ${IfThen} "$R9" == "too_long" ${|} StrCpy $R9 "" ${|}
151
152         ${IfNot} "$R9" == ""
153                 DetailPrint "Parameters: $R9"
154         ${EndIf}
155
156         ; --------
157
158         RunTryAgain:
159         
160         DetailPrint "ExecShellWait: $PLUGINSDIR\LameXP-Install.exe"
161         ${StdUtils.ExecShellWait} $R1 "$PLUGINSDIR\LameXP-Install.exe" "open" '$R9'
162         DetailPrint "Result: $R1"
163         
164         StrCmp $R1 "error" RunFailed
165         StrCmp $R1 "no_wait" RunSuccess
166         Sleep 333
167         HideWindow
168         ${StdUtils.WaitForProc} $R1
169         Goto RunSuccess
170         
171         ; --------
172
173         RunFailed:
174
175         MessageBox MB_RETRYCANCEL|MB_ICONSTOP|MB_TOPMOST "Failed to launch the installer. Please try again!" IDRETRY RunTryAgain
176
177         ; --------
178
179         ClearErrors
180         ExecShell "open" "$PLUGINSDIR\LameXP-Install.exe" '$R9' SW_SHOWNORMAL
181         IfErrors 0 RunSuccess
182
183         ClearErrors
184         ExecShell "" "$PLUGINSDIR\LameXP-Install.exe" '$R9' SW_SHOWNORMAL
185         IfErrors 0 RunSuccess
186
187         ; --------
188
189         SetDetailsPrint both
190         DetailPrint "Failed to launch installer :-("
191         SetDetailsPrint listonly
192
193         Abort "Aborted."
194
195         ; --------
196         
197         RunSuccess:
198
199         Delete /REBOOTOK "$PLUGINSDIR\LameXP-Install.exe"
200 SectionEnd