source: mlx.nsi@ 20:c2c47ea02649

Last change on this file since 20:c2c47ea02649 was 20:c2c47ea02649, checked in by István Váradi <ivaradi@…>, 11 years ago

Added support for creating an installer package

File size: 3.2 KB
Line 
1; NSIS installer script for MAVA Logger X
2
3;--------------------------------
4;Include Modern UI
5
6 !include "MUI.nsh"
7 !include "mlx-common.nsh"
8
9;--------------------------------
10;General
11
12 ;Name and file
13 Name "MAVA Logger X"
14 Caption "MAVA Logger X ${MLX_VERSION} Setup"
15 OutFile "MAVA Logger X-${MLX_VERSION}-Setup.exe"
16
17 ;Default installation folder
18 InstallDir "$PROGRAMFILES\MAVA Logger X"
19
20 ;Get installation folder from registry if available
21 InstallDirRegKey HKCU "Software\MAVA Logger X" ""
22
23 ;Vista redirects $SMPROGRAMS to all users without this
24 RequestExecutionLevel admin
25
26;--------------------------------
27;Variables
28
29 Var MUI_TEMP
30 Var STARTMENU_FOLDER
31
32;--------------------------------
33;Interface Settings
34
35 ;!define MUI_ICON "cflib\cfgui.ico"
36 ;!define MUI_UNICON "cflib\cfgui_uninst.ico"
37 !define MUI_ABORTWARNING
38
39;--------------------------------
40;Pages
41
42 !insertmacro MUI_PAGE_LICENSE "license.txt"
43 !insertmacro MUI_PAGE_COMPONENTS
44 !insertmacro MUI_PAGE_DIRECTORY
45
46 ;Start Menu Folder Page Configuration
47 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
48 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\MAVA Logger X"
49 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
50
51 !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
52
53 !insertmacro MUI_PAGE_INSTFILES
54
55 !insertmacro MUI_UNPAGE_CONFIRM
56 !insertmacro MUI_UNPAGE_INSTFILES
57
58;--------------------------------
59;Languages
60
61 !insertmacro MUI_LANGUAGE "English"
62
63;--------------------------------
64;Installer Sections
65
66Section "MAVA Logger X" SecMLX
67
68 SetOutPath "$INSTDIR"
69
70 ;ADD YOUR OWN FILES HERE...
71 File /r dist\*.*
72
73 ;Store installation folder
74 WriteRegStr HKCU "Software\MAVA Logger X" "" $INSTDIR
75
76 ;Create uninstaller
77 WriteUninstaller "$INSTDIR\Uninstall.exe"
78
79 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
80 ;Create shortcuts
81 CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
82 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MAVA Logger X.lnk" "$INSTDIR\runmlx.exe"
83 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
84 CreateShortCut "$DESKTOP\MAVA Logger X.lnk" "$INSTDIR\runmlx.exe"
85 !insertmacro MUI_STARTMENU_WRITE_END
86SectionEnd
87
88;--------------------------------
89;Descriptions
90
91 ;Language strings
92 LangString DESC_SecMLX ${LANG_ENGLISH} "MAVA Logger X."
93
94 ;Assign language strings to sections
95 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
96 !insertmacro MUI_DESCRIPTION_TEXT ${SecMLX} $(DESC_SecMLX)
97 !insertmacro MUI_FUNCTION_DESCRIPTION_END
98
99;--------------------------------
100;Uninstaller Section
101
102Section "Uninstall"
103
104 RMDir /r "$INSTDIR"
105
106 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
107
108 Delete "$DESKTOP\MAVA Logger X.lnk"
109 Delete "$SMPROGRAMS\$MUI_TEMP\MAVA Logger X.lnk"
110 Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
111
112 ;Delete empty start menu parent diretories
113 StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
114
115 startMenuDeleteLoop:
116 ClearErrors
117 RMDir $MUI_TEMP
118 GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
119
120 IfErrors startMenuDeleteLoopDone
121
122 StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
123 startMenuDeleteLoopDone:
124
125 DeleteRegKey /ifempty HKCU "Software\MAVA Logger X"
126SectionEnd
Note: See TracBrowser for help on using the repository browser.