Debian Codegraph @

data/win32/fl_app.nsi

raw
1 # -*- conf -*-
2
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
6
7 # substitute your application name for instances of FLMSG
8
9 # Variables
10 !define FLMSG_DESCRIPTION "${FLMSG_NAME} ${FLMSG_VERSION}"
11 !define FLMSG_STRING "${FLMSG_NAME}-${FLMSG_VERSION}"
12
13 !define PRODUCT_BINARY "${FLMSG_BINARY}"
14 !define PRODUCT_NAME "${FLMSG_NAME}"
15 !define PRODUCT_VERSION "${FLMSG_VERSION}"
16 !define PRODUCT_STRING "${FLMSG_STRING}"
17 !define PRODUCT_DESCRIPTION "${FLMSG_DESCRIPTION}"
18
19 # Compression options
20 SetCompressor /SOLID lzma
21
22 # This function is called before displaying the first installer page.
23 # It aborts the installation if the Windows version is too old.
24 !include WinVer.nsh
25 Function .onInit
26 ${IfNot} ${AtLeastWin2000}
27 MessageBox MB_ICONSTOP "Sorry, your Windows version is too old.$\n${PRODUCT_NAME} requires Windows 2000 or later."
28 Abort
29 ${EndIf}
30 FunctionEnd
31
32 # The name of the installer
33 Name "${PRODUCT_DESCRIPTION}"
34
35 # The file to write
36 OutFile ${INSTALLER_FILE}
37
38 # The default installation directory
39 InstallDir $PROGRAMFILES\${PRODUCT_STRING}
40
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"
45
46 # Request application privileges for Windows Vista
47 RequestExecutionLevel admin
48
49 # License
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"
55
56 # Other options
57 BrandingText " "
58 InstProgressFlags smooth
59 VIAddVersionKey ProductName "${PRODUCT_NAME}"
60 VIAddVersionKey ProductVersion "${PRODUCT_VERSION}"
61 VIAddVersionKey FileVersion "${PRODUCT_VERSION}"
62 VIAddVersionKey FileDescription "${FLMSG_DESCRIPTION} installer"
63 VIAddVersionKey LegalCopyright "${PRODUCT_NAME} developers"
64 VIAddVersionKey OriginalFilename "${INSTALLER_FILE}"
65 VIProductVersion "3.0.0.0"
66 WindowIcon off
67 XPStyle on
68
69 # Installer pages
70 Page license
71 Page components
72 Page directory
73 Page instfiles
74 UninstPage uninstConfirm
75 UninstPage instfiles
76
77 # Registry uninstall path
78 !define REG_UNINSTALL_PATH Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_STRING}
79
80 # This is a hidden section and is always selected. It writes the uninstall
81 # registry keys and uninstaller binary.
82 Section -install
83 # Set output path to the installation directory.
84 SetOutPath $INSTDIR
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" "FLMSG 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"
99 SectionEnd
100
101 #Var WANT_FLMSG
102
103 Section "FLMSG"
104 SectionIn RO
105 SetOutPath $INSTDIR
106 File "${FLMSG_BINARY}"
107 SectionEnd
108
109 # Start Menu path
110 !define SM_PATH_BASE $SMPROGRAMS\${PRODUCT_NAME}
111 !define SM_PATH ${SM_PATH_BASE}\${PRODUCT_STRING}
112
113 # The following sections are optional
114 Section "Start Menu Shortcuts"
115 CreateDirectory "${SM_PATH}"
116 CreateShortCut "${SM_PATH}\${FLMSG_NAME}.lnk" "$INSTDIR\${FLMSG_BINARY}" "" "$INSTDIR\${FLMSG_BINARY}" 0
117 CreateShortCut "${SM_PATH}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
118 SectionEnd
119
120 Section "Desktop Shortcuts"
121 CreateShortCut "$DESKTOP\${FLMSG_DESCRIPTION}.lnk" "$INSTDIR\${FLMSG_BINARY}" "" \
122 "$INSTDIR\${FLMSG_BINARY}" 0
123 SectionEnd
124
125 # This is unselected by default
126 Section /o "Quick Launch Shortcuts"
127 CreateShortCut "$QUICKLAUNCH\${FLMSG_DESCRIPTION}}.lnk" "$INSTDIR\${FLMSG_BINARY}" "" \
128 "$INSTDIR\${FLMSG_BINARY}" 0
129 SectionEnd
130
131 # Uninstaller
132 Section "Uninstall"
133 # Remove registry keys
134 DeleteRegKey HKLM "${REG_UNINSTALL_PATH}"
135 DeleteRegKey HKLM "${INSTALL_DIR_REG_KEY}"
136
137 # Remove files and uninstaller
138 Delete /REBOOTOK $INSTDIR\${FLMSG_BINARY}
139 Delete /REBOOTOK $INSTDIR\uninstall.exe
140
141 # Remove shortcuts, if any
142 Delete "${SM_PATH}\*.*"
143 Delete "$DESKTOP\${FLMSG_DESCRIPTION}.lnk"
144 Delete "$QUICKLAUNCH\${FLMSG_DESCRIPTION}.lnk"
145
146 # Remove directories used
147 RMDir "${SM_PATH}"
148 RMDir "${SM_PATH_BASE}"
149 RMDir "$INSTDIR"
150 SectionEnd
151
152 # Offer to reboot the machine if the reboot flag is nonzero. This flag is set by
153 # commands that specify the /REBOOTOK switch if the BINARY_* files were in use
154 # during uninstallation. Stupid Windows.
155 Function un.onGUIEnd
156 IfRebootFlag 0 noreboot
157 MessageBox MB_YESNO|MB_ICONQUESTION \
158 "A reboot is required to finish removing ${PRODUCT_NAME}. Do you wish to reboot now?" IDNO noreboot
159 Reboot
160 noreboot:
161 FunctionEnd
162
163 # Tell the user if we could not reboot for some reason.
164 Function un.onRebootFailed
165 MessageBox MB_OK|MB_ICONSTOP "Reboot failed. Please reboot manually." /SD IDOK
166 FunctionEnd