experienceui-setup.nsi
author Dan
Mon, 03 Aug 2009 21:48:40 -0400
changeset 14 61f1654b7734
child 15 d3e8fdadd6d6
permissions -rw-r--r--
Added a basic, but working, installer.
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
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     6
!define XPUI_SYSDIR ".\Contrib\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     7
!include "${XPUI_SYSDIR}\XPUI.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     8
OutFile "experienceui-${XPUI_VERSION}.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
     9
InstallDir "$PROGRAMFILES\NSIS\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    10
InstallDirRegKey HKLM "Software\NSIS\ExperienceUI" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    11
RequestExecutionLevel admin
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    12
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    13
${Page} Welcome2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    14
${LicensePage} "Contrib\ExperienceUI\License.rtf"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    15
${Page} Directory
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    16
${Page} InstConfirm
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    17
${Page} InstFiles
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    18
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    19
${UnPage} Welcome2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    20
${UnPage} UnConfirm
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    21
${UnPage} InstFiles
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    22
${UnPage} Finish
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    23
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    24
${Language} English
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    25
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    26
Function .onInit
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    27
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    28
  ReadRegStr $0 HKLM "Software\NSIS" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    29
  IfErrors 0 +2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    30
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    31
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    32
  ; Set installation dir only if the ExUI is not installed
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    33
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    34
  ReadRegStr $R0 HKLM "Software\NSIS\ExperienceUI" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    35
  IfErrors +2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    36
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    37
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    38
  StrCpy $INSTDIR "$0\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    39
FunctionEnd
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    40
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    41
Section
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    42
  SetOutPath $INSTDIR
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    43
  File /r Contrib
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    44
  File /r Docs
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    45
  File /r Examples
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    46
  File /r Include
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    47
  File /r Plugins
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    48
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    49
  ; Write install dir
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    50
  WriteRegStr HKLM "Software\NSIS\ExperienceUI" "" "$INSTDIR"
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 uninstaller
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    53
  WriteUninstaller "$INSTDIR\uninstall-exui.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    54
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    55
  ; Registry stuff
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    56
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayName" "$(^Name)"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    57
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "UninstallString" "$INSTDIR\uninstall-exui.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    58
  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
    59
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    60
  ; Register with NSIS
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    61
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    62
  ReadRegStr $0 HKLM "Software\NSIS" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    63
  IfErrors 0 +3
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    64
    ; NSIS not found
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    65
    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
    66
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    67
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    68
  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
    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
  ; Write in .nsh
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    72
  ; $0 = NSIS installation dir
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    73
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    74
  FileOpen $1  "$0\Include\XPUI.nsh" "w"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    75
  FileWrite $1 "!define XPUI_SYSDIR $\"$INSTDIR\Contrib\ExperienceUI$\"$\r$\n"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    76
  FileWrite $1 "!include $\"$$"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    77
  ; stupid compiler bugs...
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    78
  FileWrite $1 "{XPUI_SYSDIR}\XPUI.nsh$\"$\r$\n"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    79
  FileClose $0
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    80
SectionEnd
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    81
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    82
Section "Uninstall"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    83
  Delete "$INSTDIR\uninstall-exui.exe"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    84
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    85
  DeleteRegKey HKLM "Software\NSIS\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    86
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    87
  ; The goal here: completely clean up the ExperienceUI, but if
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    88
  ; there's other stuff, don't touch it
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    89
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    90
  ; Remember, only RmDir /r removes directories with files.
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    91
  ; Otherwise, it only removes fully empty directories.
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    92
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    93
  ; Contrib
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    94
  RmDir /r "$INSTDIR\Contrib\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    95
  Delete "$INSTDIR\Contrib\Graphics\Icons\XPUI-install.ico"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    96
  Delete "$INSTDIR\Contrib\Graphics\Icons\XPUI-uninstall.ico"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    97
  RmDir  "$INSTDIR\Contrib\Graphics\Icons"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    98
  RmDir  "$INSTDIR\Contrib\Graphics"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
    99
  RmDir  "$INSTDIR\Contrib"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   100
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   101
  ; Docs
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   102
  RmDir /r "$INSTDIR\Docs\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   103
  RmDir "$INSTDIR\Docs"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   104
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   105
  ; Examples
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   106
  RmDir /r "$INSTDIR\Examples\ExperienceUI"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   107
  RmDir "$INSTDIR\Examples"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   108
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   109
  ; Include
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   110
  Delete "$INSTDIR\Include\NSISArray.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   111
  Delete "$INSTDIR\Include\RecFind.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   112
  Delete "$INSTDIR\Include\system.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   113
  Delete "$INSTDIR\Include\XPUI.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   114
  RmDir "$INSTDIR\Include"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   115
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   116
  ; Plugins
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   117
  Delete "$INSTDIR\Plugins\DcryptDll.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   118
  Delete "$INSTDIR\Plugins\messagebox.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   119
  Delete "$INSTDIR\Plugins\newadvsplash.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   120
  Delete "$INSTDIR\Plugins\NSISArray.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   121
  Delete "$INSTDIR\Plugins\WAnsis.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   122
  Delete "$INSTDIR\Plugins\ZipDLL.dll"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   123
  RmDir "$INSTDIR\Plugins"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   124
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   125
  RmDir "$INSTDIR"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   126
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   127
  ClearErrors
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   128
  ReadRegStr $0 HKLM "Software\NSIS" ""
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   129
  IfErrors +2
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   130
    Return
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   131
    
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   132
  Delete "$0\Include\XPUI.nsh"
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   133
  
61f1654b7734 Added a basic, but working, installer.
Dan
parents:
diff changeset
   134
SectionEnd