rev |
line source |
erjo@97
|
1 ; Tazusb
|
erjo@97
|
2 ; Windows installer for Slitaz
|
erjo@97
|
3 ; (c) 2009 Cedric Tissieres (slitaz@objectif-securite.ch)
|
erjo@97
|
4 ; You'll need to put 7z.exe and 7z.dll from http://www.7-zip.org/ and syslinux.exe from http://syslinux.zytor.com/
|
erjo@97
|
5 ; in the NSIS plugins directory before compiling the script. Adapt the FROM_DIR constant too.
|
erjo@97
|
6 ; To add a translation, add the corresponding "!insertmacro MUI_LANGUAGE" and translates all the LangString you'll find below.
|
erjo@97
|
7
|
erjo@97
|
8 !define NAME "TazUSB - SliTaz LiveUSB utility "
|
erjo@97
|
9 !define FILENAME "tazusb"
|
erjo@97
|
10 !define VERSION "v0.2"
|
erjo@97
|
11 !define FROM_DIR "C:\ophcrack\livecd"
|
erjo@97
|
12
|
erjo@97
|
13 SetCompressor LZMA
|
erjo@97
|
14 CRCCheck On
|
erjo@97
|
15 XPStyle on
|
erjo@97
|
16
|
erjo@97
|
17 !include "MUI2.nsh"
|
erjo@97
|
18 !include "FileFunc.nsh"
|
erjo@97
|
19
|
erjo@97
|
20
|
erjo@97
|
21 # MUI Settings #####################################
|
erjo@97
|
22 ;**************
|
erjo@97
|
23
|
erjo@97
|
24 ; Interface settings
|
erjo@97
|
25 !define MUI_FINISHPAGE_NOAUTOCLOSE
|
erjo@97
|
26 !define MUI_HEADERIMAGE
|
erjo@97
|
27 !define MUI_HEADERIMAGE_BITMAP "${FROM_DIR}\slitaz-logo-nsis.bmp"
|
erjo@97
|
28 !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
|
erjo@97
|
29
|
erjo@97
|
30 ; Welcome page
|
erjo@97
|
31 !define MUI_WELCOMEPAGE_TITLE $(Welcome_Title)
|
erjo@97
|
32 !define MUI_WELCOMEPAGE_TEXT $(Welcome_Text)
|
erjo@97
|
33 !insertmacro MUI_PAGE_WELCOME
|
erjo@97
|
34 ; ISO page
|
erjo@97
|
35 Var IsoFileHw
|
erjo@97
|
36 Var IsoFile
|
erjo@97
|
37 Var Label
|
erjo@97
|
38 Var Label2
|
erjo@97
|
39 Page custom isoFilePage
|
erjo@97
|
40 ; Drive page
|
erjo@97
|
41 Var DestDriveHW
|
erjo@97
|
42 Var DestDrive
|
erjo@97
|
43 Page custom drivePage
|
erjo@97
|
44 ; Warning page
|
erjo@97
|
45 Page custom warningPage
|
erjo@97
|
46 ; Instfiles page
|
erjo@97
|
47 !insertmacro MUI_PAGE_INSTFILES
|
erjo@97
|
48 ; Finish page
|
erjo@97
|
49 !define MUI_FINISHPAGE_TITLE $(Finish_Title)
|
erjo@97
|
50 !define MUI_FINISHPAGE_TEXT $(Finish_Text)
|
erjo@97
|
51 !define MUI_FINISHPAGE_LINK $(Finish_Link)
|
erjo@97
|
52 !define MUI_FINISHPAGE_LINK_LOCATION "http://slitaz.org"
|
erjo@97
|
53 !insertmacro MUI_PAGE_FINISH
|
erjo@97
|
54
|
erjo@97
|
55 ; Language files
|
erjo@97
|
56 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
erjo@97
|
57 !insertmacro MUI_LANGUAGE "French"
|
erjo@97
|
58 !insertmacro MUI_LANGUAGE "Portuguese"
|
erjo@97
|
59
|
erjo@97
|
60
|
erjo@97
|
61 ; Reserve files
|
erjo@97
|
62
|
erjo@97
|
63 ; MUI end ------
|
erjo@97
|
64
|
erjo@97
|
65 ; General Parameters
|
erjo@97
|
66 Name "${NAME} ${VERSION}"
|
erjo@97
|
67 OutFile "${FROM_DIR}\${FILENAME}.exe"
|
erjo@97
|
68
|
erjo@97
|
69 # Languages ######################################
|
erjo@97
|
70
|
erjo@97
|
71 ; English
|
erjo@97
|
72 LangString Welcome_Title ${LANG_ENGLISH} "${NAME}"
|
erjo@97
|
73 LangString Welcome_Text ${LANG_ENGLISH} "Welcome to TazUSB. This tool will help you install Slitaz on a USB drive."
|
erjo@97
|
74 LangString Finish_Title ${LANG_ENGLISH} "TazUSB has completed Slitaz installation."
|
erjo@97
|
75 LangString Finish_Text ${LANG_ENGLISH} "Slitaz is now installed on your USB drive and the drive is bootable."
|
erjo@97
|
76 LangString Finish_Link ${LANG_ENGLISH} "Slitaz website"
|
erjo@97
|
77 LangString IsoPage_Title ${LANG_ENGLISH} "Select ISO file"
|
erjo@97
|
78 LangString IsoPage_Title2 ${LANG_ENGLISH} "Choose the ISO image which will be installed on your USB drive."
|
erjo@97
|
79 LangString IsoPage_Text ${LANG_ENGLISH} "Select Slitaz ISO file to be installed on your USB drive. You can download it from http://www.slitaz.org if needed."
|
erjo@97
|
80 LangString IsoPage_Input ${LANG_ENGLISH} "Slitaz ISO File"
|
erjo@97
|
81 LangString IsoFile ${LANG_ENGLISH} "ISO file|*.iso"
|
erjo@97
|
82 LangString DrivePage_Title ${LANG_ENGLISH} "Choose USB drive location"
|
paul@135
|
83 LangString DrivePage_Title2 ${LANG_ENGLISH} "Choose the USB drive on which to install Slitaz."
|
paul@135
|
84 LangString DrivePage_Text ${LANG_ENGLISH} "TazUSB will install Slitaz on the following drive. Make sure that this drive can be safely deleted! Click Next to continue."
|
erjo@97
|
85 LangString DrivePage_Input ${LANG_ENGLISH} "Destination USB Drive"
|
erjo@97
|
86 LangString WarningPage_Title ${LANG_ENGLISH} "Warning!"
|
erjo@97
|
87 LangString WarningPage_Title2 ${LANG_ENGLISH} "TazUSB is ready to install Slitaz on the selected drive."
|
erjo@97
|
88 LangString WarningPage_Text ${LANG_ENGLISH} "TazUSB is now ready to install Slitaz from:$\r$\n$\r$\n$IsoFile $\r$\n$\r$\non your selected destination USB drive:$\r$\n$\r$\n$DestDrive. $\r$\n$\r$\nThe contents of this drive will be deleted! If you are sure, click Next to continue."
|
erjo@97
|
89 LangString Iso2USB_Extract ${LANG_ENGLISH} "Extract files from $IsoFile"
|
erjo@97
|
90 LangString Iso2USB_CreateSyslinux ${LANG_ENGLISH} "Create syslinux configuration files on $DestDrive"
|
erjo@97
|
91 LangString Iso2USB_ExecuteSyslinux ${LANG_ENGLISH} "Execute syslinux on $R0"
|
erjo@97
|
92 LangString Iso2USB_WarningSyslinux ${LANG_ENGLISH} "An error ($R8) occurred when executing syslinux.$\r$\nYour USB drive won't be bootable..."
|
erjo@97
|
93
|
erjo@97
|
94 ; French
|
erjo@97
|
95 LangString Welcome_Title ${LANG_FRENCH} "${NAME}"
|
erjo@97
|
96 LangString Welcome_Text ${LANG_FRENCH} "Bienvenue dans TazUSB. Cet outil va vous aider à installer Slitaz sur une clé USB."
|
erjo@97
|
97 LangString Finish_Title ${LANG_FRENCH} "L'installation a été terminée par TazUSB."
|
erjo@97
|
98 LangString Finish_Text ${LANG_FRENCH} "Slitaz est maintenant installé sur votre clé USB et celle-ci est démarrable."
|
erjo@97
|
99 LangString Finish_Link ${LANG_FRENCH} "Site web de Slitaz"
|
erjo@97
|
100 LangString IsoPage_Title ${LANG_FRENCH} "Sélectionner un fichier ISO"
|
erjo@97
|
101 LangString IsoPage_Title2 ${LANG_FRENCH} "Choisissez l'image ISO qui sera installée sur votre clé USB."
|
erjo@97
|
102 LangString IsoPage_Text ${LANG_FRENCH} "Sélectionnez l'image ISO de Slitaz qui sera installée sur votre clé USB. Vous pouvez en télécharger une sur http://www.slitaz.org au besoin."
|
erjo@97
|
103 LangString IsoPage_Input ${LANG_FRENCH} "Image ISO Slitaz"
|
erjo@97
|
104 LangString IsoFile ${LANG_FRENCH} "Image ISO|*.iso"
|
erjo@97
|
105 LangString DrivePage_Title ${LANG_FRENCH} "Sélectionner un lecteur USB"
|
erjo@97
|
106 LangString DrivePage_Title2 ${LANG_FRENCH} "Choisissez le lecteur USB sur lequel sera installé Slitaz"
|
erjo@97
|
107 LangString DrivePage_Text ${LANG_FRENCH} "TazUSB va maintenant installer Slitaz sur le lecteur sélectionné ci-dessous. Assurez-vous que les données contenues sur cette clé peuvent être effacées! Cliquer sur Suivant pour continuer."
|
erjo@97
|
108 LangString DrivePage_Input ${LANG_FRENCH} "Lecteur USB de destination"
|
erjo@97
|
109 LangString WarningPage_Title ${LANG_FRENCH} "Attention!"
|
erjo@97
|
110 LangString WarningPage_Title2 ${LANG_FRENCH} "TazUSB est prêt à installer Slitaz sur le lecteur sélectionné."
|
erjo@97
|
111 LangString WarningPage_Text ${LANG_FRENCH} "TazUSB est maintenant prêt à installer Slitaz depuis:$\r$\n$\r$\n$IsoFile $\r$\n$\r$\nsur le lecteur USB sélectionné:$\r$\n$\r$\n$DestDrive. $\r$\n$\r$\nLe contenu de ce lecteur peut être effacé! Si vous êtes sûr, cliquer sur Suivant pour continuer."
|
erjo@97
|
112 LangString Iso2USB_Extract ${LANG_FRENCH} "Extraction des fichiers de $IsoFile"
|
erjo@97
|
113 LangString Iso2USB_CreateSyslinux ${LANG_FRENCH} "Création de la configuration syslinux sur $DestDrive"
|
erjo@97
|
114 LangString Iso2USB_ExecuteSyslinux ${LANG_FRENCH} "Exécution de syslinux sur $R0"
|
erjo@97
|
115 LangString Iso2USB_WarningSyslinux ${LANG_FRENCH} "Une erreur ($R8) est survenue pendant l'exécution de syslinux.$\r$\n Votre clé USB ne sera pas démarrable..."
|
erjo@97
|
116
|
erjo@97
|
117 ; Portuguese
|
erjo@97
|
118 LangString Welcome_Title ${LANG_PORTUGUESE} "${NAME}"
|
erjo@97
|
119 LangString Welcome_Text ${LANG_PORTUGUESE} "Bem-vindo ao TazUSB. Este aplicativo o ajudará a instalar o SliTaz em um drive USB."
|
erjo@97
|
120 LangString Finish_Title ${LANG_PORTUGUESE} "O TazUSB finalizou a instalação do SliTaz."
|
erjo@97
|
121 LangString Finish_Text ${LANG_PORTUGUESE} "O SliTaz está instalado em seu drive USB e o processo de boot agora pode ser feito."
|
erjo@97
|
122 LangString Finish_Link ${LANG_PORTUGUESE} "Site do Slitaz"
|
erjo@97
|
123 LangString IsoPage_Title ${LANG_PORTUGUESE} "Selecionar arquivo ISO"
|
erjo@97
|
124 LangString IsoPage_Title2 ${LANG_PORTUGUESE} "Escolher imagem ISO a ser instalada no drive USB."
|
erjo@97
|
125 LangString IsoPage_Text ${LANG_PORTUGUESE} "Selecionar imagem ISO do SliTaz a ser instalada no drive USB. Você pode obtê-la, se necessário, em http://www.slitaz.org."
|
erjo@97
|
126 LangString IsoPage_Input ${LANG_PORTUGUESE} "Arquivo ISO do SliTaz"
|
erjo@97
|
127 LangString IsoFile ${LANG_PORTUGUESE} "Arquivo ISO|*.iso"
|
erjo@97
|
128 LangString DrivePage_Title ${LANG_PORTUGUESE} "Escolha a localização do drive USB"
|
erjo@97
|
129 LangString DrivePage_Title2 ${LANG_PORTUGUESE} "Escolha o drive USB no qual o SliTaz será instalado."
|
erjo@97
|
130 LangString DrivePage_Text ${LANG_PORTUGUESE} "O TazUSB instalará o SliTaz no seguinte drive. Certifique-se de que o conteúdo deste drive possa ser seguramente apagado! Clique Next para continuar."
|
erjo@97
|
131 LangString DrivePage_Input ${LANG_PORTUGUESE} "Drive USB de destino"
|
erjo@97
|
132 LangString WarningPage_Title ${LANG_PORTUGUESE} "Aviso!"
|
erjo@97
|
133 LangString WarningPage_Title2 ${LANG_PORTUGUESE} "O TazUSB está pronto para instalar o SliTaz no drive selecionado."
|
erjo@97
|
134 LangString WarningPage_Text ${LANG_PORTUGUESE} "O TazUSB está pronto para instalar o SliTaz de:$\r$\n$\r$\n$IsoFile $\r$\n$\r$\nem seu drive de destino selecionado:$\r$\n$\r$\n$DestDrive. $\r$\n$\r$\nO conteúdo deste drive será apagado! Para prosseguir com a operação, clique Next para continuar."
|
erjo@97
|
135 LangString Iso2USB_Extract ${LANG_PORTUGUESE} "Extrair arquivos de $IsoFile"
|
erjo@97
|
136 LangString Iso2USB_CreateSyslinux ${LANG_PORTUGUESE} "Criar arquivos de configuração do syslinux em $DestDrive"
|
erjo@97
|
137 LangString Iso2USB_ExecuteSyslinux ${LANG_PORTUGUESE} "Executar syslinux em $R0"
|
erjo@97
|
138 LangString Iso2USB_WarningSyslinux ${LANG_PORTUGUESE} "Um erro ($R8) ocorreu durante a execução do syslinux.$\r$\nSeu drive USB não será inicializável..."
|
erjo@97
|
139
|
erjo@97
|
140 # Functions #######################################
|
erjo@97
|
141
|
erjo@97
|
142 Function isoFilePage
|
erjo@97
|
143
|
erjo@97
|
144 !insertmacro MUI_HEADER_TEXT $(IsoPage_Title) $(IsoPage_Title2)
|
erjo@97
|
145
|
erjo@97
|
146 nsDialogs::Create 1018
|
erjo@97
|
147
|
erjo@97
|
148 ${If} $IsoFile == ""
|
erjo@97
|
149 GetDlgItem $6 $HWNDPARENT 1 ; Get "Next" control handle
|
erjo@97
|
150 EnableWindow $6 0 ; disable "Next" control
|
erjo@97
|
151 ${EndIf}
|
erjo@97
|
152
|
erjo@97
|
153 ${NSD_CreateLabel} 0 0 100% 30 $(IsoPage_Text)
|
erjo@97
|
154 Pop $Label
|
erjo@97
|
155
|
erjo@97
|
156 ${NSD_CreateLabel} 15 102 100% 15 $(IsoPage_Input)
|
erjo@97
|
157 Pop $Label2
|
erjo@97
|
158
|
erjo@97
|
159 nsDialogs::CreateControl EDIT ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_READONLY} ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} 10 120 85% 20 $IsoFile
|
erjo@97
|
160 Pop $IsoFileHw
|
erjo@97
|
161
|
erjo@97
|
162 ${NSD_CreateBrowseButton} 89% 120 7% 20 ...
|
erjo@97
|
163 Var /GLOBAL IsoFile_BrowseButton
|
erjo@97
|
164 Pop $IsoFile_BrowseButton
|
erjo@97
|
165 GetFunctionAddress $0 OnClick_IsoFile_BrowseButton
|
erjo@97
|
166 nsDialogs::OnClick $IsoFile_BrowseButton $0
|
erjo@97
|
167
|
erjo@97
|
168 nsDialogs::Show
|
erjo@97
|
169 FunctionEnd
|
erjo@97
|
170
|
erjo@97
|
171 Function OnClick_IsoFile_BrowseButton
|
erjo@97
|
172
|
erjo@97
|
173
|
erjo@97
|
174 nsDialogs::SelectFileDialog /NOUNLOAD open "" $(IsoFile)
|
erjo@97
|
175 Pop $0
|
erjo@97
|
176
|
erjo@97
|
177 ${If} $0 != ""
|
erjo@97
|
178 ${NSD_SetText} $IsoFileHw $0
|
erjo@97
|
179 StrCpy $IsoFile "$0"
|
erjo@97
|
180 GetDlgItem $6 $HWNDPARENT 1 ; Get "Next" control handle
|
erjo@97
|
181 EnableWindow $6 1 ; enable "Next" control
|
erjo@97
|
182 ${EndIf}
|
erjo@97
|
183
|
erjo@97
|
184 FunctionEnd
|
erjo@97
|
185
|
erjo@97
|
186 Function drivePage
|
erjo@97
|
187
|
erjo@97
|
188 !insertmacro MUI_HEADER_TEXT $(DrivePage_Title) $(DrivePage_Title2)
|
erjo@97
|
189
|
erjo@97
|
190 nsDialogs::Create 1018
|
erjo@97
|
191
|
erjo@97
|
192 ${If} $DestDrive == ""
|
erjo@97
|
193 GetDlgItem $6 $HWNDPARENT 1 ; Get "Next" control handle
|
erjo@97
|
194 EnableWindow $6 0 ; disable "Next" control
|
erjo@97
|
195 ${EndIf}
|
erjo@97
|
196
|
erjo@97
|
197 ${NSD_CreateLabel} 0 0 100% 30 $(DrivePage_Text)
|
erjo@97
|
198 Pop $Label
|
erjo@97
|
199
|
erjo@97
|
200 ${NSD_CreateLabel} 15 102 100% 15 $(DrivePage_Input)
|
erjo@97
|
201 Pop $Label2
|
erjo@97
|
202
|
erjo@97
|
203 ${NSD_CreateDroplist} 10 120 85% 20 ""
|
erjo@97
|
204 Pop $DestDriveHw
|
erjo@97
|
205 ${NSD_OnChange} $DestDriveHw db_select.onchange
|
erjo@97
|
206 ${GetDrives} "FDD+HDD" driveListFiller
|
erjo@97
|
207 ${If} $DestDrive != ""
|
erjo@97
|
208 ${NSD_CB_SelectString} $DestDriveHw $DestDrive
|
erjo@97
|
209 ${EndIf}
|
erjo@97
|
210
|
erjo@97
|
211 nsDialogs::Show
|
erjo@97
|
212 FunctionEnd
|
erjo@97
|
213
|
erjo@97
|
214 Function db_select.onchange
|
erjo@97
|
215 Pop $DestDriveHw
|
erjo@97
|
216 ${NSD_GetText} $DestDriveHw $0
|
erjo@97
|
217 StrCpy $DestDrive "$0"
|
erjo@97
|
218 GetDlgItem $6 $HWNDPARENT 1 ; Get "Next" control handle
|
erjo@97
|
219 EnableWindow $6 1 ; enable "Next" control
|
erjo@97
|
220 FunctionEnd
|
erjo@97
|
221
|
erjo@97
|
222 Function driveListFiller
|
erjo@97
|
223 SendMessage $DestDriveHw ${CB_ADDSTRING} 0 "STR:$9"
|
erjo@97
|
224 Push 1 ; must push something - see GetDrives documentation
|
erjo@97
|
225 FunctionEnd
|
erjo@97
|
226
|
erjo@97
|
227 Function warningPage
|
erjo@97
|
228
|
erjo@97
|
229 !insertmacro MUI_HEADER_TEXT $(WarningPage_Title) $(WarningPage_Title2)
|
erjo@97
|
230
|
erjo@97
|
231 nsDialogs::Create 1018
|
erjo@97
|
232
|
erjo@97
|
233 ${NSD_CreateLabel} 0 0 100% 80% $(WarningPage_Text)
|
erjo@97
|
234 Pop $Label
|
erjo@97
|
235
|
erjo@97
|
236 nsDialogs::Show
|
erjo@97
|
237 FunctionEnd
|
erjo@97
|
238
|
erjo@97
|
239 Function ExtractIt
|
erjo@97
|
240 ; Code taken from 7zarchive.nsh (c) 2008 qwertymodo
|
erjo@97
|
241
|
erjo@97
|
242 InitPluginsDir
|
erjo@97
|
243 File /oname=$PLUGINSDIR\7z.exe "${NSISDIR}\plugins\7z.exe"
|
erjo@97
|
244 File /oname=$PLUGINSDIR\7z.dll "${NSISDIR}\plugins\7z.dll"
|
erjo@97
|
245
|
erjo@97
|
246 ClearErrors
|
erjo@97
|
247
|
erjo@97
|
248 Exch $0 ; ADDITIONAL_PARAMETERS (added to the end of the program call)
|
erjo@97
|
249 Exch 1
|
erjo@97
|
250 Exch $1 ; EXTRACT_PATHS (either "fullpaths" or "nopaths"; defaults to nopaths)
|
erjo@97
|
251 Exch 2
|
erjo@97
|
252 Exch $2 ; DESTINATION_FOLDER
|
erjo@97
|
253 Exch 3
|
erjo@97
|
254 Exch $3 ; FILE_FILTER (if blank, extracts all files; allows for wildcards, e.g. "*.doc")
|
erjo@97
|
255 Exch 4
|
erjo@97
|
256 Exch $4 ; SOURCE_ARCHIVE
|
erjo@97
|
257 Push $5
|
erjo@97
|
258
|
erjo@97
|
259 ;Extract all files if no filter specified
|
erjo@97
|
260 StrCmp $3 "" +2 0
|
erjo@97
|
261 StrCpy $3 "$\"$3$\""
|
erjo@97
|
262
|
erjo@97
|
263 ;Default folder if not specified
|
erjo@97
|
264 StrCmp $2 "" 0 GotFolder
|
erjo@97
|
265 !insertmacro GetParent
|
erjo@97
|
266 ${GetParent} "$4" $2
|
erjo@97
|
267 !insertmacro GetBaseName
|
erjo@97
|
268 ${GetBaseName} "$4" $5
|
erjo@97
|
269 StrCpy $2 "$2\$5"
|
erjo@97
|
270
|
erjo@97
|
271 GotFolder:
|
erjo@97
|
272 CreateDirectory $2
|
erjo@97
|
273 StrCmp $1 "fullpaths" 0 +2
|
erjo@97
|
274 StrCpy $5 "x"
|
erjo@97
|
275 StrCmp $1 "nopaths" +2 0
|
erjo@97
|
276 StrCmp $1 "" 0 +2
|
erjo@97
|
277 StrCpy $5 "e"
|
erjo@97
|
278
|
erjo@97
|
279 nsExec::ExecToLog '"$PLUGINSDIR\7z.exe" x $\"$4$\" $\"-o$2$\" $3 $0'
|
erjo@97
|
280
|
erjo@97
|
281 Pop $0 ;nsExec return value
|
erjo@97
|
282
|
erjo@97
|
283 Pop $5
|
erjo@97
|
284 Pop $4
|
erjo@97
|
285 Pop $0
|
erjo@97
|
286 Pop $1
|
erjo@97
|
287 Pop $2
|
erjo@97
|
288 Pop $3
|
erjo@97
|
289
|
erjo@97
|
290 FunctionEnd
|
erjo@97
|
291
|
erjo@97
|
292 !macro _ExtractFromArchive SOURCE_ARCHIVE FILE_FILTER DESTINATION_FOLDER EXTRACT_PATHS ADDITIONAL_PARAMETERS
|
erjo@97
|
293 Push "${SOURCE_ARCHIVE}"
|
erjo@97
|
294 Push "${FILE_FILTER}"
|
erjo@97
|
295 Push "${DESTINATION_FOLDER}"
|
erjo@97
|
296 Push "${EXTRACT_PATHS}"
|
erjo@97
|
297 Push "${ADDITIONAL_PARAMETERS}"
|
erjo@97
|
298 Call ExtractIt
|
erjo@97
|
299 !macroend
|
erjo@97
|
300
|
erjo@97
|
301 !define ExtractFromArchive '!insertmacro "_ExtractFromArchive"'
|
erjo@97
|
302
|
erjo@97
|
303
|
erjo@97
|
304 Function .onInit
|
erjo@97
|
305
|
erjo@97
|
306 !insertmacro MUI_LANGDLL_DISPLAY
|
erjo@97
|
307
|
erjo@97
|
308 FunctionEnd
|
erjo@97
|
309
|
erjo@97
|
310 # Section #######################################
|
erjo@97
|
311
|
erjo@97
|
312
|
erjo@97
|
313 Section "iso2usb" main
|
erjo@97
|
314 InitPluginsDir
|
erjo@97
|
315 File /oname=$PLUGINSDIR\syslinux.exe "${NSISDIR}\plugins\syslinux.exe"
|
erjo@97
|
316
|
erjo@97
|
317 SetShellVarContext all
|
erjo@97
|
318
|
erjo@97
|
319 ; Extract files from archive
|
erjo@97
|
320 DetailPrint $(Iso2USB_Extract)
|
erjo@97
|
321 ${ExtractFromArchive} "$IsoFile" "" "$DestDrive" "" "-y -x![BOOT]*"
|
erjo@97
|
322
|
erjo@97
|
323 ; Create syslinux directory and files
|
erjo@97
|
324 Var /GLOBAL BootDir
|
erjo@97
|
325 StrCpy $BootDir $DestDrive -1
|
erjo@97
|
326 StrCpy $BootDir "$BootDir\boot"
|
erjo@97
|
327 IfFileExists "$BootDir\syslinux\syslinux.cfg" SkipCreateSyslinux CreateSyslinux
|
erjo@97
|
328 CreateSyslinux:
|
erjo@97
|
329 DetailPrint $(Iso2USB_CreateSyslinux)
|
erjo@97
|
330 CreateDirectory "$BootDir\syslinux"
|
erjo@97
|
331 CopyFiles "$BootDir\isolinux\*.*" "$BootDir\syslinux"
|
erjo@97
|
332 Rename "$BootDir\syslinux\isolinux.cfg" "$BootDir\syslinux\syslinux.cfg"
|
erjo@97
|
333
|
erjo@97
|
334 SkipCreateSyslinux:
|
erjo@97
|
335 ; Execute syslinux on the drive
|
erjo@97
|
336 StrCpy $R0 $DestDrive -1 ; remove \ for syslinux
|
erjo@97
|
337 ClearErrors
|
erjo@97
|
338 DetailPrint $(Iso2USB_ExecuteSyslinux)
|
erjo@97
|
339 ExecWait '$PLUGINSDIR\syslinux.exe -maf -d boot\syslinux $R0' $R8
|
erjo@97
|
340 DetailPrint "Return $R8"
|
erjo@97
|
341
|
erjo@97
|
342 Banner::destroy
|
erjo@97
|
343 ${If} $R8 != 0
|
erjo@97
|
344 MessageBox MB_ICONEXCLAMATION|MB_OK $(Iso2USB_WarningSyslinux)
|
erjo@97
|
345 ${EndIf}
|
erjo@97
|
346
|
erjo@97
|
347 SectionEnd
|