File: tuxpaint.nsi

package info (click to toggle)
tuxpaint 1%3A0.9.14-2sarge0
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,836 kB
  • ctags: 1,018
  • sloc: ansic: 19,591; makefile: 856; objc: 191; cpp: 118; python: 54; sh: 52
file content (157 lines) | stat: -rw-r--r-- 5,192 bytes parent folder | download
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# vim: noai et ts=4 tw=0
# with a few tiny modifications by Phil Harper(philh@theopencd.org)

!define PKG_VERSION "0.9.14-rc4"
!define PKG_PREFIX  "tuxpaint"

!define APP_PREFIX  "TuxPaint"
!define APP_EXE     "${APP_PREFIX}.exe"
!define APP_CFG_EXE "${APP_PREFIX}-config.exe"
!define APP_NAME    "Tux Paint"

!define TEMP1       $R0 ;Temp variable

SetCompressor   lzma
OutFile         "${PKG_PREFIX}-${PKG_VERSION}-win32-installer.exe"
Name            "${APP_NAME}"
Caption         ""
CRCCheck        on
WindowIcon      off
BGGradient      off
Icon            "..\data\images\tuxpaint-installer.ico"

# Default to not silent
SilentInstall   normal
SilentUnInstall normal

# Various default text options
MiscButtonText
InstallButtonText
FileErrorText

# Default installation dir and registry key of install directory
InstallDir  "$PROGRAMFILES\${APP_PREFIX}"
InstallDirRegKey HKLM SOFTWARE\${APP_PREFIX} "Install_Dir"

# Licence text
LicenseText "You must agree to this license before installing ${APP_NAME}"
LicenseData "../docs/copying.txt"

# Directory browsing
ComponentText       "This will install ${APP_NAME} on your computer. Select which optional things you want installed."
DirText             "Choose a directory to install ${APP_NAME} in to:"
AllowRootDirInstall false

# Install page stuff
InstProgressFlags   smooth
AutoCloseWindow     false

# Put plugin files used by the installer at the start of the archive
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "options.ini"

Var FullscreenMode  ; start TP in full-screen or windowed mode
Var Resolution      ; resolution 800x600 or 640x480

Page license
Page components
Page custom SetOptions ValidateOptions ": Runtime Options" ;Custom page.
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles

Section
  SetOutPath $INSTDIR
  File "release\${APP_EXE}"
  File "..\..\tuxpaint-config\visualc\release\${APP_CFG_EXE}"
  File "release\*.dll"

  File "tuxpaint.cfg"
  FileOpen $0 "tuxpaint.cfg" "a"
  FileSeek $0 0 END
  FileWrite $0 "fullscreen=$FullscreenMode$\r$\n"
  FileWrite $0 "nofancycursors=$FullscreenMode$\r$\n"
  FileWrite $0 "800x600=$Resolution$\r$\n"
  FileClose $0

!include "filelist.inc"

  SetOutPath $INSTDIR\locale
  File /r "locale\*.*"
  SetOutPath $INSTDIR\userdata
  File "userdata\current_id.txt"

  WriteRegStr HKLM SOFTWARE\${APP_PREFIX} "Install_Dir" "$INSTDIR"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_PREFIX}" "DisplayName" "${APP_NAME} (remove only)"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_PREFIX}" "UninstallString" '"$INSTDIR\uninstall.exe"'
  WriteUninstaller "uninstall.exe"
SectionEnd

Section "Start Menu Shortcuts"
  SetOutPath $INSTDIR
  CreateDirectory "$SMPROGRAMS\${APP_NAME}"
  CreateShortCut  "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Configuration.lnk" "$INSTDIR\${APP_CFG_EXE}" "" "$INSTDIR\${APP_CFG_EXE}" 0 "" "" "Configure ${APP_NAME}"
  CreateShortCut  "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Full Screen).lnk" "$INSTDIR\${APP_EXE}" "-f" "$INSTDIR\${APP_EXE}" 0 "" "" "Start ${APP_NAME} in Fullscreen mode"
  CreateShortCut  "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Windowed).lnk" "$INSTDIR\${APP_EXE}" "" "$INSTDIR\${APP_EXE}" 0 "" "" "Start ${APP_NAME} in a Window"
  CreateShortCut  "$SMPROGRAMS\${APP_NAME}\Readme.lnk" "$INSTDIR\docs\html\README.html" "" "$INSTDIR\docs\html\README.html" 0 "" "" "View ReadMe"
  CreateShortCut  "$SMPROGRAMS\${APP_NAME}\Licence.lnk" "$INSTDIR\docs\copying.txt" "" "$INSTDIR\docs\copying.txt" 0 "" "" "Read License"
  CreateShortCut  "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 "" "" "Remove ${APP_NAME}"
SectionEnd

Section "Desktop Shortcut"
  SetOutPath $INSTDIR
  CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}" "" "$INSTDIR\${APP_EXE}" 0  "" "" "Create a picture with ${APP_NAME}"
SectionEnd

Section "View README"
  SetOutPath $INSTDIR
  ExecShell "open" "docs\html\README.html"
SectionEnd

Function SetOptions
  Push ${TEMP1}
    InstallOptions::dialog "$PLUGINSDIR\options.ini"
    Pop ${TEMP1}
  Pop ${TEMP1}
FunctionEnd

Function ValidateOptions
  StrCpy $FullscreenMode "yes"
  ReadINIStr ${TEMP1} "$PLUGINSDIR\options.ini" "Field 4" "State"
  StrCmp ${TEMP1} "Full-Screen" skip01
    StrCpy $FullscreenMode "no"
  skip01:
  StrCpy $Resolution "yes"
  ReadINIStr ${TEMP1} "$PLUGINSDIR\options.ini" "Field 6" "State"
  StrCmp ${TEMP1} "800x600" skip02
    StrCpy $Resolution "no"
  skip02:
FunctionEnd

; init custom page
Function .onInit
  InitPluginsDir
  File /oname=$PLUGINSDIR\options.ini "options.ini"
FunctionEnd

; uninstall stuff
UninstallText "This will uninstall ${APP_NAME}. Hit 'Uninstall' to continue."

; special uninstall section.
Section "Uninstall"
  ; remove registry keys
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_PREFIX}"
  DeleteRegKey HKLM SOFTWARE\${APP_PREFIX}

  RMDir  /r "$INSTDIR\data"
  RMDir  /r "$INSTDIR\docs"
  RMDir  /r "$INSTDIR\locale"
  Delete    "$INSTDIR\*.*"

  Delete "$DESKTOP\${APP_NAME}.lnk"
  Delete "$SMPROGRAMS\${APP_NAME}\*.*"
  RMDir  "$SMPROGRAMS\${APP_NAME}"
SectionEnd