|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
; Requires files:
|
|
|
192cd8 |
; config.nsh
|
|
|
192cd8 |
; files-install.nsh
|
|
|
192cd8 |
; files-uninstall.nsh
|
|
|
192cd8 |
; files-stuff-install.nsh
|
|
|
192cd8 |
; files-stuff-uninstall.nsh
|
|
|
192cd8 |
|
|
|
192cd8 |
; Defines which will set by 'config.nsh':
|
|
|
192cd8 |
; PK_NAME - XxxxxXxxxx - name without spaces
|
|
|
192cd8 |
; PK_NAME_FULL - Xxxxx Xxxxxxxxxx - full name, may be with spaces
|
|
|
192cd8 |
; PK_ARCH - XX - architecture, 32 or 64
|
|
|
192cd8 |
; PK_VERSION - X.X - first two numbers of version
|
|
|
192cd8 |
; PK_VERSION_FULL - X.X.X-xxxxx-xxxxx - full version, without spaces
|
|
|
192cd8 |
; PK_EXECUTABLE - xxx\XxxxXxxx-xxx_xxx.exe - subpath to executable file
|
|
|
f23bb2 |
; PK_ICON - xxx\XxxxXxxx-xxx_xxx.ico - subpath to icon file (may be *.exe)
|
|
|
192cd8 |
|
|
|
192cd8 |
!include "config.nsh"
|
|
|
192cd8 |
|
|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
|
|
|
192cd8 |
!include "MUI2.nsh"
|
|
|
192cd8 |
|
|
|
192cd8 |
;second directory selection
|
|
|
192cd8 |
|
|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
|
|
|
192cd8 |
; The name of the installer
|
|
|
192cd8 |
Name "${PK_NAME_FULL} ${PK_VERSION_FULL}"
|
|
|
192cd8 |
|
|
|
192cd8 |
; The file to write
|
|
|
192cd8 |
OutFile "${PK_NAME}-${PK_VERSION_FULL}.exe"
|
|
|
192cd8 |
|
|
|
192cd8 |
; The default installation directory and registry
|
|
|
192cd8 |
InstallDir "$PROGRAMFILES${PK_ARCH}\${PK_NAME}"
|
|
|
192cd8 |
Var STUFFDIR
|
|
|
192cd8 |
|
|
|
192cd8 |
; Request application privileges for Windows Vista
|
|
|
77a621 |
RequestExecutionLevel admin
|
|
|
192cd8 |
|
|
|
192cd8 |
!insertmacro MUI_LANGUAGE "English"
|
|
|
192cd8 |
|
|
|
192cd8 |
!define MUI_ABORTWARNING
|
|
|
192cd8 |
|
|
|
192cd8 |
!define SHCNE_ASSOCCHANGED 0x8000000
|
|
|
192cd8 |
!define SHCNF_IDLIST 0
|
|
|
192cd8 |
|
|
|
192cd8 |
!define PRODUCT_REG_KEY "Software\${PK_NAME}"
|
|
|
823a31 |
!define PRODUCT_STUFF_KEY "${PRODUCT_REG_KEY}\${PK_NAME}\${PK_VERSION}"
|
|
|
192cd8 |
!define PRODUCT_UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PK_NAME}"
|
|
|
192cd8 |
!define PRODUCT_UNINSTALL_KEY2 "Software\Microsoft\Windows\CurrentVersion\Uninstall\{D9A9B1A3-9370-4BE9-9C8F-7B52EEECB973}_is1"
|
|
|
192cd8 |
!define PRODUCT_UNINSTALL_EXE "uninstall-${PK_NAME}.exe"
|
|
|
192cd8 |
|
|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
|
|
|
192cd8 |
; Pages
|
|
|
192cd8 |
|
|
|
192cd8 |
!insertmacro MUI_PAGE_COMPONENTS
|
|
|
192cd8 |
|
|
|
192cd8 |
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstDirPageLeave
|
|
|
192cd8 |
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
192cd8 |
|
|
|
192cd8 |
Function InstDirPageLeave
|
|
|
192cd8 |
StrCpy $STUFFDIR "C:\${PK_NAME} ${PK_VERSION} stuff"
|
|
|
192cd8 |
FunctionEnd
|
|
|
192cd8 |
|
|
|
192cd8 |
!define MUI_DIRECTORYPAGE_VARIABLE $STUFFDIR
|
|
|
192cd8 |
!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose stuff directory for ${PK_NAME}..."
|
|
|
192cd8 |
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Stuff Directory:"
|
|
|
192cd8 |
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
192cd8 |
!insertmacro MUI_PAGE_INSTFILES
|
|
|
192cd8 |
|
|
|
192cd8 |
!insertmacro MUI_UNPAGE_CONFIRM
|
|
|
192cd8 |
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
192cd8 |
|
|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
; Installer
|
|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
|
|
|
192cd8 |
Section "${PK_NAME_FULL} (required)"
|
|
|
192cd8 |
SetRegView ${PK_ARCH}
|
|
|
192cd8 |
|
|
|
192cd8 |
SectionIn RO
|
|
|
192cd8 |
|
|
|
192cd8 |
SetOutPath "$INSTDIR"
|
|
|
192cd8 |
!include "files-install.nsh"
|
|
|
192cd8 |
|
|
|
192cd8 |
SetOutPath "$STUFFDIR"
|
|
|
192cd8 |
!include "files-stuff-install.nsh"
|
|
|
192cd8 |
|
|
|
192cd8 |
WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Path" "$INSTDIR"
|
|
|
192cd8 |
WriteRegStr HKLM "${PRODUCT_REG_KEY}" "Version" "${PK_VERSION_FULL}"
|
|
|
823a31 |
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZROOT" "$STUFFDIR"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZPROJECTS" "$STUFFDIR\projects"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZCACHEROOT" "$STUFFDIR\cache"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZCONFIG" "$STUFFDIR\config"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZPROFILES" "$STUFFDIR\profiles"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZFXPRESETS" "$STUFFDIR\fxs"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZLIBRARY" "$STUFFDIR\library"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "TOONZSTUDIOPALETTE" "$STUFFDIR\studiopalette"
|
|
|
823a31 |
WriteRegStr HKLM "${PRODUCT_STUFF_KEY}" "FARMROOT" ""
|
|
|
192cd8 |
|
|
|
192cd8 |
; Write the uninstall keys for Windows
|
|
|
192cd8 |
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayName" "${PK_NAME_FULL}"
|
|
|
192cd8 |
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion" "${PK_VERSION_FULL}"
|
|
|
192cd8 |
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\${PRODUCT_UNINSTALL_EXE}"'
|
|
|
192cd8 |
WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoModify" 1
|
|
|
192cd8 |
WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoRepair" 1
|
|
|
192cd8 |
|
|
|
192cd8 |
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
|
|
|
192cd8 |
|
|
|
192cd8 |
SetOutPath "$INSTDIR"
|
|
|
192cd8 |
WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
|
|
|
192cd8 |
SectionEnd
|
|
|
192cd8 |
|
|
|
192cd8 |
; Optional section (can be disabled by the user)
|
|
|
192cd8 |
Section "Start Menu Shortcuts"
|
|
|
192cd8 |
SetRegView ${PK_ARCH}
|
|
|
192cd8 |
|
|
|
192cd8 |
SetOutPath "$INSTDIR\bin"
|
|
|
192cd8 |
|
|
|
192cd8 |
SetShellVarContext All
|
|
|
aefcfb |
CreateDirectory "$SMPROGRAMS\${PK_NAME} (${PK_ARCH}bit)"
|
|
|
aefcfb |
CreateShortCut "$SMPROGRAMS\${PK_NAME} (${PK_ARCH}bit)\Uninstall ${PK_NAME}.lnk" "$INSTDIR\uninstall-${PK_NAME}.exe" "" "$INSTDIR\uninstall-${PK_NAME}.exe" 0
|
|
|
aefcfb |
CreateShortCut "$SMPROGRAMS\${PK_NAME} (${PK_ARCH}bit)\${PK_NAME}.lnk" "$INSTDIR\${PK_EXECUTABLE}" "" "$INSTDIR\${PK_ICON}" 0
|
|
|
192cd8 |
SectionEnd
|
|
|
192cd8 |
|
|
|
c93fde |
Section "Desktop Icon"
|
|
|
c93fde |
SetRegView ${PK_ARCH}
|
|
|
c93fde |
|
|
|
c93fde |
SetOutPath "$INSTDIR\bin"
|
|
|
c93fde |
|
|
|
c93fde |
SetShellVarContext All
|
|
|
c93fde |
CreateShortCut "$DESKTOP\${PK_NAME_FULL}.lnk" "$INSTDIR\${PK_EXECUTABLE}" "" "$INSTDIR\${PK_ICON}" 0
|
|
|
c93fde |
SectionEnd
|
|
|
c93fde |
|
|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
; Uninstaller
|
|
|
192cd8 |
;--------------------------------
|
|
|
192cd8 |
|
|
|
192cd8 |
Section "Uninstall"
|
|
|
192cd8 |
SetRegView ${PK_ARCH}
|
|
|
192cd8 |
|
|
|
823a31 |
ReadRegStr $INSTDIR HKLM "${PRODUCT_REG_KEY}" "Path"
|
|
|
192cd8 |
ReadRegStr $STUFFDIR HKLM "${PRODUCT_REG_KEY}\${PK_NAME}\${PK_VERSION}" "TOONZROOT"
|
|
|
192cd8 |
|
|
|
192cd8 |
; Remove registry keys
|
|
|
192cd8 |
DeleteRegKey HKLM "${PRODUCT_REG_KEY}"
|
|
|
192cd8 |
DeleteRegKey HKLM "${PRODUCT_UNINSTALL_KEY}"
|
|
|
192cd8 |
|
|
|
192cd8 |
; Remove files and uninstaller
|
|
|
192cd8 |
!include "files-stuff-uninstall.nsh"
|
|
|
192cd8 |
!include "files-uninstall.nsh"
|
|
|
192cd8 |
Delete "$INSTDIR\${PRODUCT_UNINSTALL_EXE}"
|
|
|
192cd8 |
|
|
|
192cd8 |
; Remove shortcuts, if any
|
|
|
192cd8 |
SetShellVarContext All
|
|
|
c5dd9b |
Delete "$DESKTOP\${PK_NAME_FULL}.lnk"
|
|
|
aefcfb |
Delete "$SMPROGRAMS\${PK_NAME} (${PK_ARCH}bit)\${PK_NAME}.lnk"
|
|
|
aefcfb |
Delete "$SMPROGRAMS\${PK_NAME} (${PK_ARCH}bit)\Uninstall ${PK_NAME}.lnk"
|
|
|
192cd8 |
|
|
|
192cd8 |
; Remove directories used
|
|
|
aefcfb |
RMDir "$SMPROGRAMS\${PK_NAME} (${PK_ARCH}bit)"
|
|
|
192cd8 |
RMDir "$STUFFDIR"
|
|
|
192cd8 |
RMDir "$INSTDIR"
|
|
|
192cd8 |
|
|
|
192cd8 |
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
|
|
|
192cd8 |
SectionEnd
|
|
|
192cd8 |
|
|
|
192cd8 |
Function .onInit
|
|
|
1cf1eb |
|
|
|
1cf1eb |
SetRegView ${PK_ARCH}
|
|
|
1cf1eb |
|
|
|
1cf1eb |
; Check previous installation
|
|
|
1cf1eb |
ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
|
|
|
1cf1eb |
StrCmp $R0 "" 0 oops
|
|
|
1cf1eb |
|
|
|
1cf1eb |
; Check previous installation 2
|
|
|
1cf1eb |
ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY2}" "UninstallString"
|
|
|
1cf1eb |
StrCmp $R0 "" 0 oops
|
|
|
1cf1eb |
|
|
|
192cd8 |
SetRegView 32
|
|
|
192cd8 |
|
|
|
192cd8 |
; Check previous installation
|
|
|
192cd8 |
ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
|
|
|
192cd8 |
StrCmp $R0 "" 0 oops
|
|
|
192cd8 |
|
|
|
192cd8 |
; Check previous installation 2
|
|
|
192cd8 |
ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY2}" "UninstallString"
|
|
|
192cd8 |
StrCmp $R0 "" 0 oops
|
|
|
192cd8 |
|
|
|
192cd8 |
SetRegView 64
|
|
|
192cd8 |
|
|
|
192cd8 |
; Check previous installation
|
|
|
192cd8 |
ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString"
|
|
|
192cd8 |
StrCmp $R0 "" 0 oops
|
|
|
192cd8 |
|
|
|
192cd8 |
; Check previous installation 2
|
|
|
192cd8 |
ReadRegStr $R0 HKLM "${PRODUCT_UNINSTALL_KEY2}" "UninstallString"
|
|
|
192cd8 |
StrCmp $R0 "" 0 oops
|
|
|
192cd8 |
|
|
|
192cd8 |
BringToFront
|
|
|
192cd8 |
Return
|
|
|
192cd8 |
|
|
|
192cd8 |
oops:
|
|
|
1f2234 |
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Another version of OpenToonz appears to be installed, we recommend to make backup of the Stuff directory and uninstall another version first. Do you wish to continue with installation of this version anyway?" IDNO cancel
|
|
|
55ef56 |
BringToFront
|
|
|
55ef56 |
Return
|
|
|
55ef56 |
|
|
|
55ef56 |
cancel:
|
|
|
192cd8 |
Abort
|
|
|
192cd8 |
FunctionEnd
|