3
# NSIS installer script based on example2.nsi from the nsis-2.44 distribution.
4
# Copyright (c) 2009 Stelios Bounanos, M0GLD.
5
# Copyright (c) 2009 Dave Freese, W1HKJ
7
# substitute your application name for instances of FLRIG
10
!define FLRIG_DESCRIPTION "${FLRIG_NAME} ${FLRIG_VERSION}"
11
!define FLRIG_STRING "${FLRIG_NAME}-${FLRIG_VERSION}"
13
!define PRODUCT_BINARY "${FLRIG_BINARY}"
14
!define PRODUCT_NAME "${FLRIG_NAME}"
15
!define PRODUCT_VERSION "${FLRIG_VERSION}"
16
!define PRODUCT_STRING "${FLRIG_STRING}"
17
!define PRODUCT_DESCRIPTION "${FLRIG_DESCRIPTION}"
20
SetCompressor /SOLID lzma
22
# This function is called before displaying the first installer page.
23
# It aborts the installation if the Windows version is too old.
26
${IfNot} ${AtLeastWin2000}
27
MessageBox MB_ICONSTOP "Sorry, your Windows version is too old.$\n${PRODUCT_NAME} requires Windows 2000 or later."
32
# The name of the installer
33
Name "${PRODUCT_DESCRIPTION}"
36
OutFile ${INSTALLER_FILE}
38
# The default installation directory
39
InstallDir $PROGRAMFILES\${PRODUCT_STRING}
41
# Registry key to check for directory (so if you install again, it will
42
# overwrite the old one automatically)
43
!define INSTALL_DIR_REG_KEY SOFTWARE\${PRODUCT_STRING}
44
InstallDirRegKey HKLM "${INSTALL_DIR_REG_KEY}" "Install_Dir"
46
# Request application privileges for Windows Vista
47
RequestExecutionLevel admin
50
LicenseText "${PRODUCT_NAME} is distributed under the GNU GPL as detailed \
51
below. You must abide by the terms of this license if you modify or \
52
redistribute the program." "Continue"
53
LicenseData "${LICENSE_FILE}"
54
SubCaption 0 ": License Information"
58
InstProgressFlags smooth
59
VIAddVersionKey ProductName "${PRODUCT_NAME}"
60
VIAddVersionKey ProductVersion "${PRODUCT_VERSION}"
61
VIAddVersionKey FileVersion "${PRODUCT_VERSION}"
62
VIAddVersionKey FileDescription "${FLRIG_DESCRIPTION} installer"
63
VIAddVersionKey LegalCopyright "${PRODUCT_NAME} developers"
64
VIAddVersionKey OriginalFilename "${INSTALLER_FILE}"
65
VIProductVersion "3.0.0.0"
74
UninstPage uninstConfirm
77
# Registry uninstall path
78
!define REG_UNINSTALL_PATH Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_STRING}
80
# This is a hidden section and is always selected. It writes the uninstall
81
# registry keys and uninstaller binary.
83
# Set output path to the installation directory.
85
# Write the installation paths into the registry
86
WriteRegStr HKLM "${INSTALL_DIR_REG_KEY}" "Install_Dir" "$INSTDIR"
87
# Write the uninstall keys for Windows
88
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "DisplayName" "${PRODUCT_DESCRIPTION}"
89
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "DisplayVersion" "${PRODUCT_VERSION}"
90
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "DisplayIcon" '"$INSTDIR\${PRODUCT_BINARY}"'
91
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "HelpLink" "${SUPPORT_URL}"
92
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "Publisher" "FLRIG developers"
93
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "URLUpdateInfo" "${UPDATES_URL}"
94
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "UninstallString" '"$INSTDIR\uninstall.exe"'
95
WriteRegStr HKLM "${REG_UNINSTALL_PATH}" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
96
WriteRegDWORD HKLM "${REG_UNINSTALL_PATH}" "NoModify" 1
97
WriteRegDWORD HKLM "${REG_UNINSTALL_PATH}" "NoRepair" 1
98
WriteUninstaller "uninstall.exe"
106
File "${FLRIG_BINARY}"
110
!define SM_PATH_BASE $SMPROGRAMS\${PRODUCT_NAME}
111
!define SM_PATH ${SM_PATH_BASE}\${PRODUCT_STRING}
113
# The following sections are optional
114
Section "Start Menu Shortcuts"
115
CreateDirectory "${SM_PATH}"
116
CreateShortCut "${SM_PATH}\${FLRIG_NAME}.lnk" "$INSTDIR\${FLRIG_BINARY}" "" "$INSTDIR\${FLRIG_BINARY}" 0
117
# CreateShortCut "${SM_PATH}\${FLRIG_NAME} Beginners' Guide.lnk" "${GUIDE_URL}"
118
# CreateShortCut "${SM_PATH}\${FLRIG_NAME} Documentation.lnk" "${FLRIG_DOCS_URL}"
119
CreateShortCut "${SM_PATH}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
122
Section "Desktop Shortcuts"
123
CreateShortCut "$DESKTOP\${FLRIG_DESCRIPTION}.lnk" "$INSTDIR\${FLRIG_BINARY}" "" \
124
"$INSTDIR\${FLRIG_BINARY}" 0
127
# This is unselected by default
128
Section /o "Quick Launch Shortcuts"
129
CreateShortCut "$QUICKLAUNCH\${FLRIG_DESCRIPTION}}.lnk" "$INSTDIR\${FLRIG_BINARY}" "" \
130
"$INSTDIR\${FLRIG_BINARY}" 0
135
# Remove registry keys
136
DeleteRegKey HKLM "${REG_UNINSTALL_PATH}"
137
DeleteRegKey HKLM "${INSTALL_DIR_REG_KEY}"
139
# Remove files and uninstaller
140
Delete /REBOOTOK $INSTDIR\${FLRIG_BINARY}
141
Delete /REBOOTOK $INSTDIR\uninstall.exe
143
# Remove shortcuts, if any
144
Delete "${SM_PATH}\*.*"
145
Delete "$DESKTOP\${FLRIG_DESCRIPTION}.lnk"
146
Delete "$QUICKLAUNCH\${FLRIG_DESCRIPTION}.lnk"
148
# Remove directories used
150
RMDir "${SM_PATH_BASE}"
154
# Offer to reboot the machine if the reboot flag is nonzero. This flag is set by
155
# commands that specify the /REBOOTOK switch if the BINARY_* files were in use
156
# during uninstallation. Stupid Windows.
158
IfRebootFlag 0 noreboot
159
MessageBox MB_YESNO|MB_ICONQUESTION \
160
"A reboot is required to finish removing ${PRODUCT_NAME}. Do you wish to reboot now?" IDNO noreboot
165
# Tell the user if we could not reboot for some reason.
166
Function un.onRebootFailed
167
MessageBox MB_OK|MB_ICONSTOP "Reboot failed. Please reboot manually." /SD IDOK