Fixed silent install.
[mplayer-setup-win32.git] / MPUI_Wrapper.nsi
blob68d464337664c12ff6e14657ff5a11843fa281ad
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2013 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 ; ///////////////////////////////////////////////////////////////////////////////
23 ;--------------------------------------------------------------------------------
24 ; BASIC DEFINES
25 ;--------------------------------------------------------------------------------
27 !ifndef MPLAYER_BUILDNO
28 !error "MPLAYER_BUILDNO is not defined !!!"
29 !endif
31 !ifndef MPLAYER_DATE
32 !error "MPLAYER_DATE is not defined !!!"
33 !endif
35 !ifndef MPLAYER_OUTFILE
36 !error "MPLAYER_OUTPUT_FILE is not defined !!!"
37 !endif
39 !ifndef MPLAYER_SRCFILE
40 !error "MPLAYER_SOURCE_FILE is not defined !!!"
41 !endif
43 !ifndef UPX_PATH
44 !error "UPX_PATH is not defined !!!"
45 !endif
47 ; Web-Site
48 !define MyWebSite "http://mulder.at.gg/"
50 ; Temp file name
51 !define TempFileName "$PLUGINSDIR\MPUI-Installer-r${MPLAYER_BUILDNO}.exe"
54 ;--------------------------------------------------------------------------------
55 ; INCLUDES
56 ;--------------------------------------------------------------------------------
58 !include `LogicLib.nsh`
59 !include `StdUtils.nsh`
62 ;--------------------------------------------------------------------------------
63 ; INSTALLER ATTRIBUTES
64 ;--------------------------------------------------------------------------------
66 XPStyle on
67 RequestExecutionLevel user
68 InstallColors /windows
70 Name "MPlayer for Windows ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
71 Caption "MPlayer for Windows ${MPLAYER_DATE} (Build #${MPLAYER_BUILDNO})"
72 BrandingText "MPlayer-Win32 (Build #${MPLAYER_BUILDNO})"
73 Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
74 ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
75 OutFile "${MPLAYER_OUTFILE}"
77 ShowInstDetails show
78 AutoCloseWindow true
79 InstallDir ""
82 ;--------------------------------
83 ;Page Captions
84 ;--------------------------------
86 SubCaption 0 " "
87 SubCaption 1 " "
88 SubCaption 2 " "
89 SubCaption 3 " "
90 SubCaption 4 " "
93 ;--------------------------------------------------------------------------------
94 ; COMPRESSOR
95 ;--------------------------------------------------------------------------------
97 !packhdr "$%TEMP%\exehead.tmp" '"${UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
100 ;--------------------------------------------------------------------------------
101 ; RESERVE FILES
102 ;--------------------------------------------------------------------------------
104 ReserveFile "${NSISDIR}\Plugins\Banner.dll"
105 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
106 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
107 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
108 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
109 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
110 ReserveFile "${NSISDIR}\Plugins\System.dll"
111 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
114 ;--------------------------------------------------------------------------------
115 ; VERSION INFO
116 ;--------------------------------------------------------------------------------
118 !searchreplace PRODUCT_VERSION_DATE "${MPLAYER_DATE}" "-" "."
119 VIProductVersion "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
121 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
122 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."
123 VIAddVersionKey "CompanyName" "Free Software Foundation"
124 VIAddVersionKey "FileDescription" "MPlayer for Windows (Build #${MPLAYER_BUILDNO})"
125 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${MPLAYER_BUILDNO}"
126 VIAddVersionKey "LegalCopyright" "Copyright 2000-2013 The MPlayer Project"
127 VIAddVersionKey "LegalTrademarks" "GNU"
128 VIAddVersionKey "OriginalFilename" "MPUI-Setup.exe"
129 VIAddVersionKey "ProductName" "MPlayer for Windows"
130 VIAddVersionKey "ProductVersion" "Build #${MPLAYER_BUILDNO} (${MPLAYER_DATE})"
131 VIAddVersionKey "Website" "${MPlayerWebSite}"
134 ;--------------------------------
135 ;Installer initialization
136 ;--------------------------------
138 Section "-LaunchTheInstaller"
139 SetDetailsPrint textonly
140 DetailPrint "Launching installer, please stay tuned..."
141 SetDetailsPrint listonly
143 InitPluginsDir
144 SetOutPath "$PLUGINSDIR"
145 File "/oname=${TempFileName}" "${MPLAYER_SRCFILE}"
147 ; --------
149 ${StdUtils.GetAllParameters} $R9 0
150 ${IfThen} "$R9" == "too_long" ${|} StrCpy $R9 "" ${|}
152 ${IfNot} "$R9" == ""
153 DetailPrint "Parameters: $R9"
154 ${EndIf}
156 ; --------
158 ${Do}
159 DetailPrint "ExecShellWait: ${TempFileName}"
160 ${StdUtils.ExecShellWait} $R1 "${TempFileName}" "open" '$R9'
161 DetailPrint "Result: $R1"
163 ${IfThen} $R1 == "no_wait" ${|} Goto SetupCompleted ${|}
165 ${If} $R1 != "error"
166 Sleep 333
167 HideWindow
168 ${StdUtils.WaitForProc} $R1
169 Goto SetupCompleted
170 ${EndIf}
172 MessageBox MB_RETRYCANCEL|MB_ICONSTOP|MB_TOPMOST "Failed to launch the installer. Please try again!" IDCANCEL FallbackMode
173 ${Loop}
175 ; --------
177 FallbackMode:
179 ClearErrors
180 ExecShell "open" "${TempFileName}" '$R9' SW_SHOWNORMAL
181 IfErrors 0 SetupCompleted
183 ClearErrors
184 ExecShell "" "${TempFileName}" '$R9' SW_SHOWNORMAL
185 IfErrors 0 SetupCompleted
187 ; --------
189 SetDetailsPrint both
190 DetailPrint "Failed to launch installer :-("
191 SetDetailsPrint listonly
193 Abort "Aborted."
195 ; --------
197 SetupCompleted:
199 ${For} $R0 1 5
200 Delete "${TempFileName}"
201 Sleep 333
202 ${Next}
204 Delete /REBOOTOK "${TempFileName}"
205 SectionEnd