-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnsis-config.nsi
67 lines (57 loc) · 2.5 KB
/
nsis-config.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
!include "MUI2.nsh"
!define COMPANYNAME "wedesoft"
!define APPNAME "sfsim"
Name "sfsim"
Outfile "sfsim-installer.exe"
InstallDir "$PROGRAMFILES64\sfsim"
InstallDirRegKey HKLM "Software\NSIS_sfsim" "Install_Dir"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "sfsim (required)"
SectionIn RO
# Install JRE, JAR, config, and icon
SetOutPath $INSTDIR
File "logo.ico"
File /r "out-windows\*.*"
# Write data
SetOutPath "$INSTDIR\data"
File /r "data\*.*"
# Create uninstaller
setOutPath $INSTDIR
writeUninstaller "$INSTDIR\uninstall.exe"
# Write installation path
WriteRegStr HKLM "SOFTWARE\NSIS_sfsim" "Install_Dir" "$INSTDIR"
# Register uninstaller
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "0.1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" '"$INSTDIR\logo.ico"'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
SectionEnd
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\sfsim"
CreateShortCut "$SMPROGRAMS\sfsim\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\sfsim\sfsim.lnk" "$INSTDIR\sfsim.exe" "" "$INSTDIR\logo.ico" 0
SectionEnd
Section "Desktop Shortcut"
CreateShortCut "$DESKTOP\sfsim.lnk" "$INSTDIR\sfsim.exe" "" "$INSTDIR\logo.ico" 0
SectionEnd
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\NSIS_sfsim"
; Remove files and uninstaller
RmDir /r "$INSTDIR\*.*"
Rmdir "$INSTDIR"
; Remove shortcuts, if any
Delete "$SMPROGRAMS\sfsim\*.*"
Delete "$DESKTOP\sfsim.lnk"
; Remove directories used
RMDir "$SMPROGRAMS\sfsim"
SectionEnd