experienceui-setup.nsi
author Dan
Thu, 17 Dec 2009 05:32:39 -0500
changeset 19 6c9560a32dc7
parent 15 d3e8fdadd6d6
permissions -rw-r--r--
Added Portuguese (2070) translation. Thanks Adriano Pereira!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     1
; ExperienceUI installation
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     2
Name "ExperienceUI SDK"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     3
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     4
SetCompressor /final /solid lzma
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     5
15
d3e8fdadd6d6 Version bump to 1.3.1, final testing to follow
Dan
parents: 14
diff changeset
     6
!define XPUI_ABORTWARNING
14
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     7
!define XPUI_SYSDIR ".\Contrib\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     8
!include "${XPUI_SYSDIR}\XPUI.nsh"
15
d3e8fdadd6d6 Version bump to 1.3.1, final testing to follow
Dan
parents: 14
diff changeset
     9
Caption "$(^Name) v${XPUI_VERSION} Setup"
14
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    10
OutFile "experienceui-${XPUI_VERSION}.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    11
InstallDir "$PROGRAMFILES\NSIS\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    12
InstallDirRegKey HKLM "Software\NSIS\ExperienceUI" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    13
RequestExecutionLevel admin
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    14
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    15
${Page} Welcome2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    16
${LicensePage} "Contrib\ExperienceUI\License.rtf"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    17
${Page} Directory
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    18
${Page} InstConfirm
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    19
${Page} InstFiles
15
d3e8fdadd6d6 Version bump to 1.3.1, final testing to follow
Dan
parents: 14
diff changeset
    20
${Page} Abort
14
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    21
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    22
${UnPage} Welcome2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    23
${UnPage} UnConfirm
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    24
${UnPage} InstFiles
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    25
${UnPage} Finish
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    26
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    27
${Language} English
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    28
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    29
Function .onInit
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    30
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    31
  ReadRegStr $0 HKLM "Software\NSIS" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    32
  IfErrors 0 +2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    33
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    34
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    35
  ; Set installation dir only if the ExUI is not installed
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    36
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    37
  ReadRegStr $R0 HKLM "Software\NSIS\ExperienceUI" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    38
  IfErrors +2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    39
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    40
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    41
  StrCpy $INSTDIR "$0\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    42
FunctionEnd
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    43
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    44
Section
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    45
  SetOutPath $INSTDIR
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    46
  File /r Contrib
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    47
  File /r Docs
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    48
  File /r Examples
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    49
  File /r Include
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    50
  File /r Plugins
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    51
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    52
  ; Write install dir
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    53
  WriteRegStr HKLM "Software\NSIS\ExperienceUI" "" "$INSTDIR"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    54
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    55
  ; Write uninstaller
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    56
  WriteUninstaller "$INSTDIR\uninstall-exui.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    57
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    58
  ; Registry stuff
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    59
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayName" "$(^Name)"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    60
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "UninstallString" "$INSTDIR\uninstall-exui.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    61
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayIcon" "$INSTDIR\Contrib\Graphics\Icons\XPUI-install.ico"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    62
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    63
  ; Register with NSIS
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    64
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    65
  ReadRegStr $0 HKLM "Software\NSIS" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    66
  IfErrors 0 +3
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    67
    ; NSIS not found
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    68
    MessageBox MB_OK|MB_ICONEXCLAMATION "Setup did not detect NSIS on your system. Integrating the ExperienceUI with NSIS will be your job once you install NSIS."
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    69
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    70
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    71
  MessageBox MB_YESNO|MB_ICONQUESTION "Found NSIS installation at $0. Do you want to register the ExperienceUI SDK with this copy of NSIS?$\n$\n(If you don't, you'll have to specify the full path to XPUI.nsh in your scripts.)" IDYES +2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    72
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    73
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    74
  ; Write in .nsh
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    75
  ; $0 = NSIS installation dir
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    76
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    77
  FileOpen $1  "$0\Include\XPUI.nsh" "w"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    78
  FileWrite $1 "!define XPUI_SYSDIR $\"$INSTDIR\Contrib\ExperienceUI$\"$\r$\n"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    79
  FileWrite $1 "!include $\"$$"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    80
  ; stupid compiler bugs...
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    81
  FileWrite $1 "{XPUI_SYSDIR}\XPUI.nsh$\"$\r$\n"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    82
  FileClose $0
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    83
SectionEnd
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    84
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    85
Section "Uninstall"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    86
  Delete "$INSTDIR\uninstall-exui.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    87
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    88
  DeleteRegKey HKLM "Software\NSIS\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    89
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    90
  ; The goal here: completely clean up the ExperienceUI, but if
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    91
  ; there's other stuff, don't touch it
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    92
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    93
  ; Remember, only RmDir /r removes directories with files.
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    94
  ; Otherwise, it only removes fully empty directories.
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    95
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    96
  ; Contrib
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    97
  RmDir /r "$INSTDIR\Contrib\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    98
  Delete "$INSTDIR\Contrib\Graphics\Icons\XPUI-install.ico"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    99
  Delete "$INSTDIR\Contrib\Graphics\Icons\XPUI-uninstall.ico"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   100
  RmDir  "$INSTDIR\Contrib\Graphics\Icons"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   101
  RmDir  "$INSTDIR\Contrib\Graphics"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   102
  RmDir  "$INSTDIR\Contrib"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   103
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   104
  ; Docs
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   105
  RmDir /r "$INSTDIR\Docs\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   106
  RmDir "$INSTDIR\Docs"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   107
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   108
  ; Examples
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   109
  RmDir /r "$INSTDIR\Examples\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   110
  RmDir "$INSTDIR\Examples"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   111
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   112
  ; Include
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   113
  Delete "$INSTDIR\Include\NSISArray.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   114
  Delete "$INSTDIR\Include\RecFind.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   115
  Delete "$INSTDIR\Include\system.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   116
  Delete "$INSTDIR\Include\XPUI.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   117
  RmDir "$INSTDIR\Include"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   118
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   119
  ; Plugins
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   120
  Delete "$INSTDIR\Plugins\DcryptDll.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   121
  Delete "$INSTDIR\Plugins\messagebox.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   122
  Delete "$INSTDIR\Plugins\newadvsplash.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   123
  Delete "$INSTDIR\Plugins\NSISArray.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   124
  Delete "$INSTDIR\Plugins\WAnsis.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   125
  Delete "$INSTDIR\Plugins\ZipDLL.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   126
  RmDir "$INSTDIR\Plugins"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   127
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   128
  RmDir "$INSTDIR"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   129
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   130
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   131
  ReadRegStr $0 HKLM "Software\NSIS" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   132
  IfErrors +2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   133
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   134
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   135
  Delete "$0\Include\XPUI.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   136
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   137
SectionEnd