1 ;NSIS Modern User Interface
2 ;Start Menu Folder Selection Example Script
3 ;Written by Joost Verburg
5 ;--------------------------------
10 ;--------------------------------
15 OutFile "tinyerp-server-setup.exe"
17 ;Default installation folder
18 InstallDir "$PROGRAMFILES\TinyERP Server"
20 ;Get installation folder from registry if available
21 InstallDirRegKey HKCU "Software\TinyERP Server" ""
23 ;Vista redirects $SMPROGRAMS to all users without this
24 RequestExecutionLevel admin
26 ;--------------------------------
32 ;--------------------------------
35 !define MUI_ABORTWARNING
37 ;--------------------------------
40 !insertmacro MUI_PAGE_WELCOME
41 !insertmacro MUI_PAGE_LICENSE "doc\\License.rtf"
42 # !insertmacro MUI_PAGE_COMPONENTS
43 !insertmacro MUI_PAGE_DIRECTORY
45 ;Start Menu Folder Page Configuration
46 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
47 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\TinyERP Server"
48 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "TinyERP Server"
50 !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
52 !insertmacro MUI_PAGE_INSTFILES
54 !define MUI_FINISHPAGE_NOAUTOCLOSE
55 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
56 !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
57 !insertmacro MUI_PAGE_FINISH
60 !insertmacro MUI_UNPAGE_WELCOME
61 !insertmacro MUI_UNPAGE_CONFIRM
62 !insertmacro MUI_UNPAGE_INSTFILES
64 ;--------------------------------
67 !insertmacro MUI_LANGUAGE "English"
69 ;--------------------------------
72 Section "TinyERP Server" SecTinyERPServer
76 ;ADD YOUR OWN FILES HERE...
79 ;Store installation folder
80 WriteRegStr HKCU "Software\TinyERP Server" "" $INSTDIR
83 WriteUninstaller "$INSTDIR\Uninstall.exe"
85 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
88 CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
89 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\TinyERP Server.lnk" "$INSTDIR\tinyerp-server.exe"
90 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
92 !insertmacro MUI_STARTMENU_WRITE_END
99 LangString DESC_SecTinyERPServer ${LANG_ENGLISH} "TinyERP Server."
101 ;Assign language strings to sections
102 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
103 !insertmacro MUI_DESCRIPTION_TEXT ${SecTinyERPServer} $(DESC_SecTinyERPServer)
104 !insertmacro MUI_FUNCTION_DESCRIPTION_END
106 ;--------------------------------
111 ;ADD YOUR OWN FILES HERE...
112 Delete "$INSTDIR\Uninstall.exe"
113 Push "$INSTDIR\addons"
115 Call un.RmFilesButOne
117 Delete "$INSTDIR\Uninstall.exe"
119 Push "$INSTDIR\addons"
122 RMDir "$INSTDIR\addons"
125 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
127 Delete "$SMPROGRAMS\$MUI_TEMP\TinyERP Server.lnk"
128 Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
130 ;Delete empty start menu parent diretories
131 StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
136 GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
138 IfErrors startMenuDeleteLoopDone
140 StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
141 startMenuDeleteLoopDone:
143 DeleteRegKey /ifempty HKCU "Software\TinyERP Server"
147 Function un.RmDirsButOne
148 Exch $R0 ; exclude dir
154 FindFirst $R3 $R2 "$R1\*.*"
161 IfFileExists "$R1\$R2\*.*" 0 Next
164 #Goto Exit ;uncomment this to stop it being recursive
181 Function un.RmFilesButOne
182 Exch $R0 ; exclude file
188 FindFirst $R3 $R2 "$R1\*.*"
195 IfFileExists "$R1\$R2\*.*" Next
198 #Goto Exit ;uncomment this to stop it being recursive