/[ascend]/trunk/nsis/download.nsi
ViewVC logotype

Contents of /trunk/nsis/download.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2605 - (show annotations) (download)
Tue Apr 24 06:14:23 2012 UTC (12 years, 2 months ago) by jpye
File size: 2073 byte(s)
Working on re-adding support for dependency download in installer (incl 64-bit).
1 Var DAI_RET
2 Var DAI_MSG
3 Var DAI_TMPFILE
4 Var DAI_REMOVE
5
6 !macro downloadAndInstall DAI_NAME DAI_URL DAI_FN DAI_CMD
7 Push $0
8 Push $1
9
10 StrCpy $DAI_RET ""
11 StrCpy $DAI_REMOVE ""
12
13 ${If} ${FileExists} "${DAI_FN}"
14 DetailPrint "Found local file ${DAI_FN}..."
15 ${If} ${Cmd} `MessageBox MB_ICONQUESTION|MB_YESNO "File ${DAI_FN} was found in the current directory, so it may not be necessary to download it now.$\n$\nWould you like to run this local copy of the installer?" IDYES `
16 StrCpy $DAI_RET "success"
17 StrCpy $DAI_TMPFILE "${DAI_FN}"
18 ${EndIf}
19 ${EndIf}
20
21 ${If} $DAI_RET != "success"
22 DetailPrint "Downloading file ${DAI_FN}..."
23 StrCpy $DAI_TMPFILE "$TEMP\${DAI_FN}"
24 nsisdl::download /TIMEOUT=30000 "${DAI_URL}" "$DAI_TMPFILE"
25 Pop $DAI_RET ;Get the return value
26
27 ${DoWhile} $DAI_RET != "success"
28 ${If} $DAI_RET == "cancel"
29 StrCpy $DAI_MSG "cancelled"
30 ${Else}
31 StrCpy $DAI_MSG "failed (return '$DAI_RET')"
32 ${EndIf}
33
34 DetailPrint "Download of ${DAI_FN} $DAI_MSG."
35 ${IfNot} ${Cmd} `MessageBox MB_ICONEXCLAMATION|MB_YESNO "${DAI_NAME} download $DAI_MSG.$\n$\nDo you wish to re-attempt the download?" IDYES `
36 ; response was no
37 ;MessageBox MB_OK "File ${DAI_NAME} will not be installed..."
38 Pop $1
39 Pop $0
40 Push 1 ; error code
41 Return
42 ${EndIf}
43
44 ;MessageBox MB_OK "Will re-attempt download of ${DAI_NAME}"
45 ${If} ${FileExists} "$DAI_TMPFILE"
46 Delete "$DAI_TMPFILE"
47 ${EndIf}
48 ${Loop}
49
50 StrCpy $DAI_REMOVE "1"
51 ${EndIf}
52
53
54 ;MessageBox MB_OK "Installing ${DAI_NAME}...$\n$\nCommand: ${DAI_CMD}"
55 DetailPrint "Installing ${DAI_NAME} (${DAI_FN})"
56 ExecWait "${DAI_CMD}" $0
57 DetailPrint "Installer return code = $0"
58 ${If} $0 != "0"
59 MessageBox MB_ICONEXCLAMATION|MB_OK "${DAI_NAME} installer returned a non-zero error code '$0'"
60 ${EndIf}
61
62 ${If} $DAI_REMOVE != ""
63 ;MessageBox MB_OK "Deleting $DAI_TMPFILE..."
64 Delete "$DAI_TMPFILE"
65 ${EndIf}
66
67 ; Restore registers
68 Pop $1
69 Pop $0
70
71 ; Return values
72 Push $0
73 !macroend

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22