blob: b444e1fb23cabf9e9fd066fc916d3f0337188a7f [file] [log] [blame]
Edric Milaret34eb9202015-05-14 12:36:41 -04001!define APPNAME "Ring"
2!define COMPANYNAME "Savoir-Faire Linux"
3!define DESCRIPTION "The Ring client for Windows"
4# These three must be integers
5!define VERSIONMAJOR 0
6!define VERSIONMINOR 1
7!define VERSIONBUILD 1
8# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
9# It is possible to use "mailto:" links in here to open the email client
10!define HELPURL "https://projects.savoirfairelinux.com/projects/ring/wiki" # "Support Information" link
11!define UPDATEURL "http://ring.cx/en/documentation/windows-installation" # "Product Updates" link
12!define ABOUTURL "http://ring.cx/en#about" # "Publisher" link
13
14!include "MUI2.nsh"
15
16!define MUI_WELCOMEPAGE
17!define MUI_LICENSEPAGE
18!define MUI_DIRECTORYPAGE
19!define MUI_ABORTWARNING
20!define MUI_UNINSTALLER
21!define MUI_UNCONFIRMPAGE
22!define MUI_FINISHPAGE
23
24!insertmacro MUI_LANGUAGE "English"
25
26RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
27
28InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
29
30# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
31LicenseData "License.rtf"
32# This will be in the installer/uninstaller's title bar
33Name "${COMPANYNAME} - ${APPNAME}"
34
35outFile "ring-windows-${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}.exe"
36
37!include LogicLib.nsh
38!include "FileFunc.nsh"
39
40# Just three pages - license agreement, install location, and installation
41page license
42page directory
43Page instfiles
44
45!macro VerifyUserIsAdmin
46UserInfo::GetAccountType
47pop $0
48${If} $0 != "admin" ;Require admin rights on NT4+
49 messageBox mb_iconstop "Administrator rights required!"
50 setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
51 quit
52${EndIf}
53!macroend
54
55function .onInit
56 setShellVarContext all
57 !insertmacro VerifyUserIsAdmin
58functionEnd
59
60section "install"
61 # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
62 setOutPath $INSTDIR
63 # Files added here should be removed by the uninstaller (see section "uninstall")
64 file "RingClientWindows.exe"
65 file "ring.ico"
66 file *.dll
67 setOutPath $INSTDIR\platforms
68 file platforms/*
69 setOutPath $INSTDIR\imageformats
70 file imageformats/*
71 setOutPath $INSTDIR\ringtones
72 file ringtones/*
73
74 # Uninstaller - See function un.onInit and section "uninstall" for configuration
75 writeUninstaller "$INSTDIR\uninstall.exe"
76
77 #Desktop
78 CreateShortCut "$DESKTOP\Ring.lnk" "$INSTDIR\RingClientWindows.exe" ""
79
80 # Start Menu
81 createDirectory "$SMPROGRAMS\${COMPANYNAME}"
82 createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\RingClientWindows.exe" "" "$INSTDIR\ring.ico"
83
84 # Registry information for add/remove programs
85 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" ${APPNAME}
86 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
87 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
88 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
89 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\ring.ico$\""
90 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
91 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
92 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
93 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
94 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"
95 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
96 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
97 # There is no option for modifying or repairing the install
98 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
99 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
100 ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
101 IntFmt $0 "0x%08X" $0
102 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" "$0"
103sectionEnd
104
105# Uninstaller
106
107function un.onInit
108 SetShellVarContext all
109
110 #Verify the uninstaller - last chance to back out
111 MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
112 Abort
113 next:
114 !insertmacro VerifyUserIsAdmin
115functionEnd
116
117section "uninstall"
118
119 # Remove Start Menu launcher
120 delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
121 # Try to remove the Start Menu folder - this will only happen if it is empty
122 rmDir "$SMPROGRAMS\${COMPANYNAME}"
123
124 # Remove files
125 delete $INSTDIR\RingClientWindows.exe
126 delete $INSTDIR\ring.ico
127 delete $INSTDIR\*.dll
128 rmDir /r $INSTDIR\platforms
129 rmDir /r $INSTDIR\imageformats
130 rmDir /r $INSTDIR\ringtones
131
132 # Always delete uninstaller as the last action
133 delete $INSTDIR\uninstall.exe
134
135 # Try to remove the install directory - this will only happen if it is empty
136
137 rmDir $INSTDIR
138
139 # Remove uninstaller information from the registry
140 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
141sectionEnd