-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.nsi
73 lines (59 loc) · 1.79 KB
/
build.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
68
69
70
71
72
# Script for NSIS (Nullsoft Scriptable Install System) to make a Windows installer
!define APPNAME "Oakfoam"
LicenseData "COPYING"
# This will be in the installer/uninstaller's title bar
Name "${APPNAME}"
Icon "other/icon.ico"
# define installer name
outFile "oakfoam-installer.exe"
# set desktop as install directory
InstallDir "$PROGRAMFILES\${APPNAME}"
Page license
#Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
# default section
section
# output path
setOutPath $INSTDIR
# installation files
File oakfoam.exe
File book.dat
File web.gtp
File other/icon.ico
FileOpen $4 "$INSTDIR\oakfoam-web.bat" w
FileWrite $4 "@echo off$\r$\n"
FileWrite $4 "start /b oakfoam --web -c web.gtp$\r$\n"
FileWrite $4 "start http://localhost:8000$\r$\n"
FileWrite $4 "pause$\r$\n"
FileClose $4
# www files
SetOutPath $INSTDIR\www
File /r www\*
setOutPath $INSTDIR
# uninstaller name
writeUninstaller $INSTDIR\uninstaller.exe
# shortcuts
createDirectory "$SMPROGRAMS\${APPNAME}"
createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\oakfoam-web.bat" "" "$INSTDIR\icon.ico"
createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstaller.exe"
sectionEnd
# section to define what the uninstaller does
section "Uninstall"
# remove shortcuts
delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
rmDir "$SMPROGRAMS\${APPNAME}"
# now delete installation files
delete $INSTDIR\oakfoam.exe
delete $INSTDIR\book.dat
delete $INSTDIR\web.gtp
delete $INSTDIR\oakfoam-web.bat
delete $INSTDIR\icon.ico
rmDir /r $INSTDIR\www
delete $INSTDIR\uninstaller.exe
# try to remove the install directory - this will only happen if it is empty
rmDir $INSTDIR
sectionEnd