Statistics
| Revision:

root / nsis / update-manager.nsi @ 3098

History | View | Annotate | Download (3.4 kB)

1
;--------------------------------
2
3
!include "sylpheed-defs.nsh"
4
5
SetCompressor /SOLID lzma
6
7
;--------------------------------
8
9
!include "nsProcess.nsh"
10
11
!include "MUI.nsh"
12
!include "Sections.nsh"
13
!include "FileFunc.nsh"
14
15
; MUI Settings
16
!define MUI_ABORTWARNING
17
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-blue.ico"
18
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-blue.ico"
19
20
; Welcome page
21
;!insertmacro MUI_PAGE_WELCOME
22
; License page
23
;!define MUI_LICENSEPAGE_RADIOBUTTONS
24
;!insertmacro MUI_PAGE_LICENSE $(license)
25
; Components page
26
;!insertmacro MUI_PAGE_COMPONENTS
27
; Directory page
28
;!insertmacro MUI_PAGE_DIRECTORY
29
; Instfiles page
30
!insertmacro MUI_PAGE_INSTFILES
31
; Finish page
32
;!define MUI_FINISHPAGE_RUN "$INSTDIR\sylpheed.exe"
33
;!define MUI_FINISHPAGE_RUN_NOTCHECKED
34
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
35
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README-win32.txt"
36
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README-win32-ja.txt"
37
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION "ShowReadme"
38
!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(readme)"
39
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
40
!define MUI_FINISHPAGE_LINK "$(jump)"
41
!define MUI_FINISHPAGE_LINK_LOCATION ${PRODUCT_WEB_SITE}
42
!insertmacro MUI_PAGE_FINISH
43
44
; Language files
45
!insertmacro MUI_LANGUAGE "English" # ${LANG_ENGLISH}
46
!insertmacro MUI_LANGUAGE "Spanish" # ${LANG_SPANISH}
47
!insertmacro MUI_LANGUAGE "Japanese" # ${LANG_JAPANESE}
48
49
!include "English.nsh"
50
!include "Spanish.nsh"
51
!include "Japanese.nsh"
52
;--------------------------------
53
54
Caption "$(^Name) Update Manager"
55
Name "${PRODUCT_NAME}"
56
OutFile "update-manager.exe"
57
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
58
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
59
60
RequestExecutionLevel admin
61
62
ShowInstDetails hide
63
XPStyle on
64
BrandingText "${INST_NAME} ${INST_VERSION}"
65
66
!define TEMP_INSTALLER_PATH  "$TEMP\${PRODUCT_NAME}_setup.exe"
67
68
Section "Download"
69
;  SetOutPath "$TEMP"
70
71
  ${GetParameters} $R0
72
  ${GetOptions} "$R0" "/uri" $1
73
74
  StrCmp "$1" "" 0 uri_option_found
75
    DetailPrint "usage: update-manager.exe /uri 'http://example.com/Sylpheed-VER_setup.exe'"
76
    DetailPrint "or update-manager.exe /uri path\to\Sylpheed-VER_setup.exe"
77
    Abort
78
  uri_option_found:
79
80
  IfFileExists "$1" copy_file
81
82
  DetailPrint "Downloading $1"
83
  NSISdl::download \
84
    /TRANSLATE2 "$(downloading)" "$(connecting)" "$(second)" "$(minute)" "$(hour)" "$(seconds)" "$(minutes)" "$(hours)" "$(progress)" \
85
    /TIMEOUT=30000 "$1" "${TEMP_INSTALLER_PATH}"
86
  Pop $0
87
  StrCmp "$0" "success" download_ok
88
  DetailPrint "$(download_failed) $0"
89
  Abort
90
91
92
  copy_file:
93
  CopyFiles "$1" "${TEMP_INSTALLER_PATH}"
94
  Goto download_ok
95
96
  download_ok:
97
SectionEnd
98
99
Section "Exec Installer"
100
  ${nsProcess::FindProcess} "sylpheed.exe" $R0
101
  StrCmp $R0 "0" 0 +3
102
  MessageBox MB_ICONQUESTION|MB_YESNO "$(kill_and_update_confirm)" /SD IDYES IDYES +2
103
  Abort
104
105
  ExecWait "$INSTDIR\sylpheed.exe --exit" $R0
106
107
  ; Wait for sylpheed.exe quit completely
108
  ${nsProcess::FindProcess} "sylpheed.exe" $R0
109
  StrCmp $R0 "0" 0 wait_done
110
  Sleep 1000
111
  ${nsProcess::FindProcess} "sylpheed.exe" $R0
112
  StrCmp $R0 "0" 0 wait_done
113
  Sleep 1000
114
  ${nsProcess::FindProcess} "sylpheed.exe" $R0
115
  StrCmp $R0 "0" 0 wait_done
116
  Sleep 1000
117
118
  wait_done:
119
  ExecWait '"${TEMP_INSTALLER_PATH}" /S' $0
120
SectionEnd
121
122
Function ShowReadme
123
  ExecShell open "$INSTDIR\README.txt"
124
FunctionEnd