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

Contents of /trunk/nsis/download.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2442 - (show annotations) (download)
Mon Mar 28 06:32:53 2011 UTC (13 years, 3 months ago) by jpye
File size: 2732 byte(s)
Update all tests after installing PyGTK All-in-one (fixes bug 498). 
Static linking top libgfortran for LSODE (fixes bug 497).
Removed attempts at MD5 sum checking, but installer is able to use local copies of downloaded files now.
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 DAI_MD5
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
20 ; Unable to get reliable behaviour with md5dll or Crypto plugins for NSIS...
21 ; md5dll::GetMD5File "${DAI_FN}"
22 ; ;Crypto::HashFile "MD5" "${DAI_FN}"
23 ; ;Pop $0
24 ; ${If} $0 == "${DAI_MD5}"
25 ; StrCpy $DAI_RET "success"
26 ; StrCpy $DAI_TMPFILE "${DAI_FN}"
27 ; ${Else}
28 ; ${If} ${Cmd} `MessageBox MB_ICONQUESTION|MB_YESNO "File ${DAI_FN} was found (with MD5 sum '$0')$\n but did not have expected MD5 '${DAI_MD5}'.$\n$\nWould you like this file to be used?" IDYES `
29 StrCpy $DAI_RET "success"
30 StrCpy $DAI_TMPFILE "${DAI_FN}"
31 ; ${EndIf}
32 ; ${EndIf}
33 ; ${Else}
34 ; MessageBox MB_OK "File ${DAI_FN} not found. Will be downloaded."
35 ${EndIf}
36
37 ${If} $DAI_RET != "success"
38 DetailPrint "Downloading file ${DAI_FN}..."
39 StrCpy $DAI_TMPFILE "$TEMP\${DAI_FN}"
40 nsisdl::download /TIMEOUT=30000 "${DAI_URL}" "$DAI_TMPFILE"
41 Pop $DAI_RET ;Get the return value
42
43 ${DoWhile} $DAI_RET != "success"
44 ${If} $DAI_RET == "cancel"
45 StrCpy $DAI_MSG "cancelled"
46 ${Else}
47 StrCpy $DAI_MSG "failed (return '$DAI_RET')"
48 ${EndIf}
49
50 DetailPrint "Download of ${DAI_FN} $DAI_MSG."
51 ${IfNot} ${Cmd} `MessageBox MB_ICONEXCLAMATION|MB_YESNO "${DAI_NAME} download $DAI_MSG.$\n$\nDo you wish to re-attempt the download?" IDYES `
52 ; response was no
53 ;MessageBox MB_OK "File ${DAI_NAME} will not be installed..."
54 Pop $1
55 Pop $0
56 Push 1 ; error code
57 Return
58 ${EndIf}
59
60 ;MessageBox MB_OK "Will re-attempt download of ${DAI_NAME}"
61 ${If} ${FileExists} "$DAI_TMPFILE"
62 Delete "$DAI_TMPFILE"
63 ${EndIf}
64 ${Loop}
65
66 StrCpy $DAI_REMOVE "1"
67 ${EndIf}
68
69
70 ;MessageBox MB_OK "Installing ${DAI_NAME}...$\n$\nCommand: ${DAI_CMD}"
71 DetailPrint "Installing ${DAI_NAME} (${DAI_FN})"
72 ExecWait "${DAI_CMD}" $0
73 DetailPrint "Installer return code = $0"
74 ${If} $0 != "0"
75 MessageBox MB_ICONEXCLAMATION|MB_OK "${DAI_NAME} installer returned a non-zero error code '$0'"
76 ${EndIf}
77
78 ${If} $DAI_REMOVE != ""
79 ;MessageBox MB_OK "Deleting $DAI_TMPFILE..."
80 Delete "$DAI_TMPFILE"
81 ${EndIf}
82
83 ; Restore registers
84 Pop $1
85 Pop $0
86
87 ; Return values
88 Push $0
89 !macroend

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