blob: 9be84c2d137a6e757f0780f4c8b5caefa855bb1f [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
Guillaume Rogueze024e472015-05-15 17:12:56 -04006!define VERSIONMINOR 3
Guillaume Roguez106bcad2015-05-15 17:03:16 -04007!define VERSIONBUILD 0
Edric Milaret34eb9202015-05-14 12:36:41 -04008# 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
Edric Milaret9e12e882015-05-21 11:52:05 -040035outFile "ring-windows-nightly.exe"
Edric Milaret34eb9202015-05-14 12:36:41 -040036
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")
Edric Milareta34e4ba2015-06-01 14:47:49 -040064 file "Ring.exe"
Edric Milaret34eb9202015-05-14 12:36:41 -040065 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
Edric Milaret465a3142015-06-02 15:02:52 -040077 SetOutPath $INSTDIR
Edric Milaret34eb9202015-05-14 12:36:41 -040078 #Desktop
Edric Milareta34e4ba2015-06-01 14:47:49 -040079 CreateShortCut "$DESKTOP\Ring.lnk" "$INSTDIR\Ring.exe" ""
Edric Milaret34eb9202015-05-14 12:36:41 -040080
81 # Start Menu
82 createDirectory "$SMPROGRAMS\${COMPANYNAME}"
Edric Milareta34e4ba2015-06-01 14:47:49 -040083 createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\Ring.exe" "" "$INSTDIR\ring.ico"
Edric Milaret34eb9202015-05-14 12:36:41 -040084
85 # Registry information for add/remove programs
86 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" ${APPNAME}
87 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
88 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
89 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
90 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\ring.ico$\""
91 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
92 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
93 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
94 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
95 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"
96 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
97 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
98 # There is no option for modifying or repairing the install
99 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
100 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
101 ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
102 IntFmt $0 "0x%08X" $0
103 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" "$0"
104sectionEnd
105
106# Uninstaller
107
108function un.onInit
109 SetShellVarContext all
110
111 #Verify the uninstaller - last chance to back out
112 MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
113 Abort
114 next:
115 !insertmacro VerifyUserIsAdmin
116functionEnd
117
118section "uninstall"
119
120 # Remove Start Menu launcher
121 delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
122 # Try to remove the Start Menu folder - this will only happen if it is empty
123 rmDir "$SMPROGRAMS\${COMPANYNAME}"
124
125 # Remove files
Edric Milareta34e4ba2015-06-01 14:47:49 -0400126 delete $INSTDIR\Ring.exe
Edric Milaret34eb9202015-05-14 12:36:41 -0400127 delete $INSTDIR\ring.ico
128 delete $INSTDIR\*.dll
129 rmDir /r $INSTDIR\platforms
130 rmDir /r $INSTDIR\imageformats
131 rmDir /r $INSTDIR\ringtones
132
133 # Always delete uninstaller as the last action
134 delete $INSTDIR\uninstall.exe
135
136 # Try to remove the install directory - this will only happen if it is empty
137
138 rmDir $INSTDIR
139
140 # Remove uninstaller information from the registry
141 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
142sectionEnd