Commit 12537cd9 authored by Justin Karneges's avatar Justin Karneges

unix line endings

parent eff51824
;******************************************************************************* ;*******************************************************************************
; psi.nsi - NSIS installer script for Psi ; psi.nsi - NSIS installer script for Psi
; ;
; Copyright (c) 2004-2008 Mircea Bardac (IceRAM) ; Copyright (c) 2004-2008 Mircea Bardac (IceRAM)
; E-mail: dev@mircea.bardac.net ; E-mail: dev@mircea.bardac.net
; XMPP: iceram@jabber.org ; XMPP: iceram@jabber.org
; ;
; This program is free software; you can redistribute it and/or ; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License ; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2 ; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version. ; of the License, or (at your option) any later version.
; ;
; This program is distributed in the hope that it will be useful, ; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of ; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details. ; GNU General Public License for more details.
; ;
; You should have received a copy of the GNU General Public License ; You should have received a copy of the GNU General Public License
; along with this file; if not, write to the Free Software ; along with this file; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
; ;
; See ReadME.txt for more information on the script. ; See ReadME.txt for more information on the script.
;******************************************************************************* ;*******************************************************************************
; Installer Script Version ; Installer Script Version
!define INSTALLER_VERSION "2.0" !define INSTALLER_VERSION "2.0"
; Psi Installer Configuration File ; Psi Installer Configuration File
!include "../config.nsh" !include "../config.nsh"
...@@ -36,221 +36,221 @@ ...@@ -36,221 +36,221 @@
!define LCAPPNAME "psi" ; lowercase APPNAME !define LCAPPNAME "psi" ; lowercase APPNAME
!define INSTALLER_COPYRIGHT_YEAR "2004-2008" !define INSTALLER_COPYRIGHT_YEAR "2004-2008"
; Version information for the installer executable ; Version information for the installer executable
VIAddVersionKey ProductName "${APPNAME}" VIAddVersionKey ProductName "${APPNAME}"
VIAddVersionKey ProductVersion "${APPFULLVERSION}" VIAddVersionKey ProductVersion "${APPFULLVERSION}"
VIAddVersionKey Comments "${APPNAMEANDVERSION} installer - build ${INSTALLER_BUILD} / script ver. ${INSTALLER_VERSION} (c) ${INSTALLER_COPYRIGHT_YEAR} The Psi Team" VIAddVersionKey Comments "${APPNAMEANDVERSION} installer - build ${INSTALLER_BUILD} / script ver. ${INSTALLER_VERSION} (c) ${INSTALLER_COPYRIGHT_YEAR} The Psi Team"
VIAddVersionKey CompanyName "" VIAddVersionKey CompanyName ""
VIAddVersionKey LegalCopyright "" VIAddVersionKey LegalCopyright ""
VIAddVersionKey FileDescription "${APPNAMEANDVERSION} Installer (build ${INSTALLER_BUILD}) - Win32 Installer v${INSTALLER_VERSION}" VIAddVersionKey FileDescription "${APPNAMEANDVERSION} Installer (build ${INSTALLER_BUILD}) - Win32 Installer v${INSTALLER_VERSION}"
VIAddVersionKey FileVersion "${INSTALLER_VERSION}b${INSTALLER_BUILD}" VIAddVersionKey FileVersion "${INSTALLER_VERSION}b${INSTALLER_BUILD}"
VIAddVersionKey InternalName "${APPNAMEANDVERSION} Installer (build ${INSTALLER_BUILD}) - Win32 Installer v${INSTALLER_VERSION}" VIAddVersionKey InternalName "${APPNAMEANDVERSION} Installer (build ${INSTALLER_BUILD}) - Win32 Installer v${INSTALLER_VERSION}"
VIAddVersionKey LegalTrademarks "" VIAddVersionKey LegalTrademarks ""
!ifdef BUILD_WITH_LANGPACKS !ifdef BUILD_WITH_LANGPACKS
VIAddVersionKey OriginalFilename "${LCAPPNAME}-${APPFULLVERSION}-win-setup.exe" VIAddVersionKey OriginalFilename "${LCAPPNAME}-${APPFULLVERSION}-win-setup.exe"
VIAddVersionKey PrivateBuild "Language Packs Included: yes" VIAddVersionKey PrivateBuild "Language Packs Included: yes"
!else !else
VIAddVersionKey OriginalFilename "${LCAPPNAME}-${APPFULLVERSION}-win-setup-base.exe" VIAddVersionKey OriginalFilename "${LCAPPNAME}-${APPFULLVERSION}-win-setup-base.exe"
VIAddVersionKey PrivateBuild "Language Packs Included: none" VIAddVersionKey PrivateBuild "Language Packs Included: none"
!endif !endif
VIAddVersionKey SpecialBuild "Build number: ${INSTALLER_BUILD}" VIAddVersionKey SpecialBuild "Build number: ${INSTALLER_BUILD}"
VIProductVersion "${APPVERSION}.0.${INSTALLER_BUILD}" VIProductVersion "${APPVERSION}.0.${INSTALLER_BUILD}"
SetCompressor lzma SetCompressor lzma
Var DONE_INIT Var DONE_INIT
Var RUN_BY_ADMIN Var RUN_BY_ADMIN
Var INST_CONTEXT Var INST_CONTEXT
Var LSTR_SHORTCUTS Var LSTR_SHORTCUTS
Var LSTR_CURRENTUSER Var LSTR_CURRENTUSER
Var LSTR_ALLUSERS Var LSTR_ALLUSERS
Var LSTR_QUICKLAUNCH Var LSTR_QUICKLAUNCH
Var LSTR_DESKTOP_S Var LSTR_DESKTOP_S
Var LSTR_STARTMENU_GROUP Var LSTR_STARTMENU_GROUP
Var LSTR_ASK_EXIT_PSI Var LSTR_ASK_EXIT_PSI
Var LSTR_UNINST_RUNNING Var LSTR_UNINST_RUNNING
Var LSTR_INST_RUNNING Var LSTR_INST_RUNNING
Var LSTR_WARN_ADMIN_1 Var LSTR_WARN_ADMIN_1
Var LSTR_WARN_ADMIN_2 Var LSTR_WARN_ADMIN_2
Var LSTR_PSIBASE Var LSTR_PSIBASE
Var LSTR_LANGUAGES Var LSTR_LANGUAGES
Var LSTR_AUTOSTART Var LSTR_AUTOSTART
Var LSTR_A_INSTALLED Var LSTR_A_INSTALLED
Var LSTR_ERR_UNINST Var LSTR_ERR_UNINST
!include "Sections.nsh" !include "Sections.nsh"
!include "installer-functions.nsh" !include "installer-functions.nsh"
!define XPSTYLE on !define XPSTYLE on
BrandingText "- ${APPNAMEANDVERSION} installer - build ${INSTALLER_BUILD} / script ver. ${INSTALLER_VERSION} (c) ${INSTALLER_COPYRIGHT_YEAR} The Psi Team " BrandingText "- ${APPNAMEANDVERSION} installer - build ${INSTALLER_BUILD} / script ver. ${INSTALLER_VERSION} (c) ${INSTALLER_COPYRIGHT_YEAR} The Psi Team "
!define HOME_URL "http://psi-im.org/" !define HOME_URL "http://psi-im.org/"
; Main Install settings ; Main Install settings
!define APP_BUILD "${INSTALLER_HOME}${FILE_SEPARATOR}build${FILE_SEPARATOR}" !define APP_BUILD "${INSTALLER_HOME}${FILE_SEPARATOR}build${FILE_SEPARATOR}"
!define INSTALLER_SRC "${INSTALLER_HOME}${FILE_SEPARATOR}src${FILE_SEPARATOR}" !define INSTALLER_SRC "${INSTALLER_HOME}${FILE_SEPARATOR}src${FILE_SEPARATOR}"
!define APP_SOURCE "${APP_BUILD}psi_app${FILE_SEPARATOR}" !define APP_SOURCE "${APP_BUILD}psi_app${FILE_SEPARATOR}"
Name "${APPNAMEANDVERSION}" Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\${APPNAME}" InstallDir "$PROGRAMFILES\${APPNAME}"
!ifdef BUILD_WITH_LANGPACKS !ifdef BUILD_WITH_LANGPACKS
OutFile "${APP_BUILD}${LCAPPNAME}-${APPFULLVERSION}-win-setup.exe" OutFile "${APP_BUILD}${LCAPPNAME}-${APPFULLVERSION}-win-setup.exe"
!else !else
OutFile "${APP_BUILD}${LCAPPNAME}-${APPFULLVERSION}-win-setup-base.exe" OutFile "${APP_BUILD}${LCAPPNAME}-${APPFULLVERSION}-win-setup-base.exe"
!endif !endif
InstallDirRegKey HKLM "Software\Affinix\${APPNAME}" "" InstallDirRegKey HKLM "Software\Affinix\${APPNAME}" ""
; Modern interface settings ; Modern interface settings
!include "MUI.nsh" !include "MUI.nsh"
;-------------------------------- ;--------------------------------
;Page settings ;Page settings
!define MUI_ICON "${INSTALLER_SRC}install.ico" !define MUI_ICON "${INSTALLER_SRC}install.ico"
!define MUI_UNICON "${INSTALLER_SRC}uninstall.ico" !define MUI_UNICON "${INSTALLER_SRC}uninstall.ico"
!define MUI_HEADERIMAGE !define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${INSTALLER_SRC}psi-header-l.bmp" !define MUI_HEADERIMAGE_BITMAP "${INSTALLER_SRC}psi-header-l.bmp"
!define MUI_HEADERIMAGE_BITMAP_RTL "${INSTALLER_SRC}psi-header-r.bmp" !define MUI_HEADERIMAGE_BITMAP_RTL "${INSTALLER_SRC}psi-header-r.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${INSTALLER_SRC}psi-header-l.bmp" !define MUI_HEADERIMAGE_UNBITMAP "${INSTALLER_SRC}psi-header-l.bmp"
!define MUI_HEADERIMAGE_UNBITMAP_RTL "${INSTALLER_SRC}psi-header-r.bmp" !define MUI_HEADERIMAGE_UNBITMAP_RTL "${INSTALLER_SRC}psi-header-r.bmp"
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_COMPONENTSPAGE_NODESC !define MUI_COMPONENTSPAGE_NODESC
!define MUI_FINISHPAGE_RUN "$INSTDIR\Psi.exe" !define MUI_FINISHPAGE_RUN "$INSTDIR\Psi.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Readme.txt" !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Readme.txt"
!define MUI_FINISHPAGE_LINK "Click here to visit the Psi Homepage" !define MUI_FINISHPAGE_LINK "Click here to visit the Psi Homepage"
!define MUI_FINISHPAGE_LINK_LOCATION "http://psi-im.org" !define MUI_FINISHPAGE_LINK_LOCATION "http://psi-im.org"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${INSTALLER_SRC}psi-l.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "${INSTALLER_SRC}psi-l.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${INSTALLER_SRC}psi-l.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${INSTALLER_SRC}psi-l.bmp"
;!define MUI_LICENSEPAGE_CHECKBOX ;!define MUI_LICENSEPAGE_CHECKBOX
;-------------------------------- ;--------------------------------
;Language Selection Dialog Settings ;Language Selection Dialog Settings
;Remember the installer language ;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKLM" !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
!define MUI_LANGDLL_REGISTRY_KEY "Software\Affinix\${APPNAME}" !define MUI_LANGDLL_REGISTRY_KEY "Software\Affinix\${APPNAME}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
PAGE custom InitRoutines PAGE custom InitRoutines
!define MUI_PAGE_CUSTOMFUNCTION_SHOW CompNames !define MUI_PAGE_CUSTOMFUNCTION_SHOW CompNames
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${APP_SOURCE}COPYING" !insertmacro MUI_PAGE_LICENSE "${APP_SOURCE}COPYING"
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
UNINSTPAGE custom un.InitRoutines UNINSTPAGE custom un.InitRoutines
!insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH !insertmacro MUI_UNPAGE_FINISH
;-------------------------------- ;--------------------------------
; Languages ; Languages
!include "installer-languages.nsh" !include "installer-languages.nsh"
;-------------------------------- ;--------------------------------
;Reserve Files ;Reserve Files
!insertmacro MUI_RESERVEFILE_LANGDLL !insertmacro MUI_RESERVEFILE_LANGDLL
;-------------------------------- ;--------------------------------
; macro for creating urls ; macro for creating urls
!Macro "CreateURL" "URLFile" "URLSite" !Macro "CreateURL" "URLFile" "URLSite"
WriteINIStr "$INSTDIR\${URLFile}.url" "InternetShortcut" "URL" "${URLSite}" WriteINIStr "$INSTDIR\${URLFile}.url" "InternetShortcut" "URL" "${URLSite}"
!macroend !macroend
;-------------------------------- ;--------------------------------
;********************************* ;*********************************
; Sections of the installer ; Sections of the installer
Section "" SectionBase Section "" SectionBase
; Set Section properties ; Set Section properties
SetOverwrite on SetOverwrite on
SectionIn RO SectionIn RO
; Set Section Files and Shortcuts ; Set Section Files and Shortcuts
!include "${APP_BUILD}psi_files_install.nsh" !include "${APP_BUILD}psi_files_install.nsh"
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
!insertmacro "CreateURL" "Psi - Home page" "http://psi-im.org" !insertmacro "CreateURL" "Psi - Home page" "http://psi-im.org"
!insertmacro "CreateURL" "Psi - Forum" "http://psi-im.org/forum" !insertmacro "CreateURL" "Psi - Forum" "http://psi-im.org/forum"
!insertmacro "CreateURL" "Psi - Documentation" "http://psi-im.org/wiki" !insertmacro "CreateURL" "Psi - Documentation" "http://psi-im.org/wiki"
SectionEnd SectionEnd
; ******************************** ; ********************************
!ifdef BUILD_WITH_LANGPACKS !ifdef BUILD_WITH_LANGPACKS
SectionGroup "_" SectionLang SectionGroup "_" SectionLang
!include "${APP_BUILD}psi_lang_install.nsh" !include "${APP_BUILD}psi_lang_install.nsh"
; See ReadME.txt for more information ; See ReadME.txt for more information
SectionGroupEnd SectionGroupEnd
!endif !endif
Section "" SectionSM Section "" SectionSM
StrCmp $RUN_BY_ADMIN "true" sm_admin StrCmp $RUN_BY_ADMIN "true" sm_admin
sm_normal: sm_normal:
SetShellVarContext current SetShellVarContext current
Goto sm_done Goto sm_done
sm_admin: sm_admin:
SetShellVarContext all SetShellVarContext all
sm_done: sm_done:
CreateDirectory "$SMPROGRAMS\${APPNAME}" CreateDirectory "$SMPROGRAMS\${APPNAME}"
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi - Forum.lnk" "$INSTDIR\Psi - Forum.url" CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi - Forum.lnk" "$INSTDIR\Psi - Forum.url"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi - Documentation.lnk" "$INSTDIR\Psi - Documentation.url" CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi - Documentation.lnk" "$INSTDIR\Psi - Documentation.url"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi - Home page.lnk" "$INSTDIR\Psi - Home page.url" CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi - Home page.lnk" "$INSTDIR\Psi - Home page.url"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi.lnk" "$INSTDIR\Psi.exe" CreateShortCut "$SMPROGRAMS\${APPNAME}\Psi.lnk" "$INSTDIR\Psi.exe"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\${APPNAME}\ReadME.lnk" "$INSTDIR\Readme.txt" CreateShortCut "$SMPROGRAMS\${APPNAME}\ReadME.lnk" "$INSTDIR\Readme.txt"
SetShellVarContext current SetShellVarContext current
SectionEnd SectionEnd
; ******************************** ; ********************************
SectionGroup "_" SectionShortcuts SectionGroup "_" SectionShortcuts
Section "" SectionSD Section "" SectionSD
SetShellVarContext current SetShellVarContext current
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
CreateShortCut "$DESKTOP\Psi.lnk" "$INSTDIR\Psi.exe" CreateShortCut "$DESKTOP\Psi.lnk" "$INSTDIR\Psi.exe"
SectionEnd SectionEnd
Section /o "" SectionQuickLaunch Section /o "" SectionQuickLaunch
SetShellVarContext current SetShellVarContext current
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
CreateShortCut "$QUICKLAUNCH\Psi.lnk" "$INSTDIR\Psi.exe" CreateShortCut "$QUICKLAUNCH\Psi.lnk" "$INSTDIR\Psi.exe"
SectionEnd SectionEnd
SectionGroupEnd SectionGroupEnd
Section "" SectionAutomaticStartup Section "" SectionAutomaticStartup
SetShellVarContext current SetShellVarContext current
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
CreateShortCut "$SMSTARTUP\Psi.lnk" "$INSTDIR\Psi.exe" CreateShortCut "$SMSTARTUP\Psi.lnk" "$INSTDIR\Psi.exe"
; WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Psi" "$INSTDIR\Psi.exe" ; WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Psi" "$INSTDIR\Psi.exe"
; ^ doesn't work - Psi is not started with the correct working dir ; ^ doesn't work - Psi is not started with the correct working dir
SectionEnd SectionEnd
Section -FinishSection Section -FinishSection
StrCmp $RUN_BY_ADMIN "true" lastsettings_is_admin StrCmp $RUN_BY_ADMIN "true" lastsettings_is_admin
WriteRegStr HKCU "Software\Affinix\${APPNAME}" "" "$INSTDIR" WriteRegStr HKCU "Software\Affinix\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKCU "Software\Affinix\${APPNAME}" "Version" "${APPFULLVERSION}" WriteRegStr HKCU "Software\Affinix\${APPNAME}" "Version" "${APPFULLVERSION}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} (remove only)" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} (remove only)"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
Goto lastsettings_done Goto lastsettings_done
lastsettings_is_admin: lastsettings_is_admin:
WriteRegStr HKLM "Software\Affinix\${APPNAME}" "" "$INSTDIR" WriteRegStr HKLM "Software\Affinix\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\Affinix\${APPNAME}" "Version" "${APPFULLVERSION}" WriteRegStr HKLM "Software\Affinix\${APPNAME}" "Version" "${APPFULLVERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} (remove only)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
lastsettings_done: lastsettings_done:
WriteUninstaller "$INSTDIR\uninstall.exe" WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd SectionEnd
Function CompNames Function CompNames
...@@ -263,257 +263,257 @@ Function CompNames ...@@ -263,257 +263,257 @@ Function CompNames
SectionSetText ${SectionSD} "$LSTR_DESKTOP_S" SectionSetText ${SectionSD} "$LSTR_DESKTOP_S"
SectionSetText ${SectionQuickLaunch} "$LSTR_QUICKLAUNCH" SectionSetText ${SectionQuickLaunch} "$LSTR_QUICKLAUNCH"
SectionSetText ${SectionAutomaticStartup} "$LSTR_AUTOSTART ($LSTR_CURRENTUSER)" SectionSetText ${SectionAutomaticStartup} "$LSTR_AUTOSTART ($LSTR_CURRENTUSER)"
FunctionEnd FunctionEnd
; *************************************** ; ***************************************
; installer initialization ; installer initialization
Function InitRoutines Function InitRoutines
StrCmp $DONE_INIT "1" done_init StrCmp $DONE_INIT "1" done_init
StrCpy $DONE_INIT "1" StrCpy $DONE_INIT "1"
; MessageBox MB_OK "Installing in $LANGUAGE" ; MessageBox MB_OK "Installing in $LANGUAGE"
!insertmacro INIT_LANG_STRINGS !insertmacro INIT_LANG_STRINGS
; allow only one instance of the installer ; allow only one instance of the installer
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "psi${APPFULLVERSION}-installer") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "psi${APPFULLVERSION}-installer") i .r1 ?e'
Pop $R0 Pop $R0
StrCmp $R0 0 +3 StrCmp $R0 0 +3
MessageBox MB_OK "$LSTR_INST_RUNNING" MessageBox MB_OK "$LSTR_INST_RUNNING"
Quit Quit
; **************** ; ****************
; close active Psi sessions ; close active Psi sessions
Call ClosePsiInstances Call ClosePsiInstances
; **************** ; ****************
; check for an existing installation of Psi ; check for an existing installation of Psi
Call UninstallPreviousPsi Call UninstallPreviousPsi
; **************** ; ****************
Call IsUserAdmin Call IsUserAdmin
Pop $R0 Pop $R0
StrCpy $RUN_BY_ADMIN $R0 ; saving information StrCpy $RUN_BY_ADMIN $R0 ; saving information
StrCmp $R0 "true" is_admin StrCmp $R0 "true" is_admin
; not an admin ; not an admin
MessageBox MB_OK|MB_ICONINFORMATION "$LSTR_WARN_ADMIN_1$\n$\n$LSTR_WARN_ADMIN_2" MessageBox MB_OK|MB_ICONINFORMATION "$LSTR_WARN_ADMIN_1$\n$\n$LSTR_WARN_ADMIN_2"
StrCpy $INST_CONTEXT $LSTR_CURRENTUSER StrCpy $INST_CONTEXT $LSTR_CURRENTUSER
goto done_init goto done_init
is_admin: is_admin:
StrCpy $INST_CONTEXT $LSTR_ALLUSERS StrCpy $INST_CONTEXT $LSTR_ALLUSERS
done_init: done_init:
FunctionEnd FunctionEnd
Function .onInit Function .onInit
; permit the user to choose the installer language ; permit the user to choose the installer language
; the setting will be used to automatically select a language pack if availaible ; the setting will be used to automatically select a language pack if availaible
!insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_LANGDLL_DISPLAY
; **************** ; ****************
; expand Shorcuts Section ; expand Shorcuts Section
SectionGetFlags ${SectionShortcuts} $0 SectionGetFlags ${SectionShortcuts} $0
IntOp $0 $0 | ${SF_EXPAND} IntOp $0 $0 | ${SF_EXPAND}
SectionSetFlags ${SectionShortcuts} $0 SectionSetFlags ${SectionShortcuts} $0
; **************** ; ****************
!ifdef BUILD_WITH_LANGPACKS !ifdef BUILD_WITH_LANGPACKS
; automatically choose language pack to install ; automatically choose language pack to install
!include "${APP_BUILD}psi_lang_setup.nsh" !include "${APP_BUILD}psi_lang_setup.nsh"
; See ReadME.txt for more information ; See ReadME.txt for more information
; **************** ; ****************
!endif !endif
StrCpy $DONE_INIT "0" StrCpy $DONE_INIT "0"
; init strings now ; init strings now
FunctionEnd FunctionEnd
; ****************************************************** ; ******************************************************
; Uninstall functions ; Uninstall functions
; function that checks if the user running the UNinstaller is an Administrator ; function that checks if the user running the UNinstaller is an Administrator
Function un.IsUserAdmin Function un.IsUserAdmin
Push $R0 Push $R0
Push $R1 Push $R1
Push $R2 Push $R2
ClearErrors ClearErrors
UserInfo::GetName UserInfo::GetName
IfErrors Win9x IfErrors Win9x
Pop $R1 Pop $R1
UserInfo::GetAccountType UserInfo::GetAccountType
Pop $R2 Pop $R2
StrCmp $R2 "Admin" 0 Continue StrCmp $R2 "Admin" 0 Continue
StrCpy $R0 "true" StrCpy $R0 "true"
Goto Done Goto Done
Continue: Continue:
StrCmp $R2 "" Win9x StrCmp $R2 "" Win9x
StrCpy $R0 "false" StrCpy $R0 "false"
Goto Done Goto Done
Win9x: Win9x:
StrCpy $R0 "true" StrCpy $R0 "true"
Done: Done:
Pop $R2 Pop $R2
Pop $R1 Pop $R1
Exch $R0 Exch $R0
FunctionEnd FunctionEnd
; ******************************** ; ********************************
; Close Psi Instances ; Close Psi Instances
; Waits for all running instances of Psi to close ; Waits for all running instances of Psi to close
Function un.ClosePsiInstances Function un.ClosePsiInstances
Push $0 ;saving stack Push $0 ;saving stack
newcheck: newcheck:
FindWindow $0 "QWidget" "Psi" 0 FindWindow $0 "QWidget" "Psi" 0
IntCmp $0 0 done IntCmp $0 0 done
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$LSTR_ASK_EXIT_PSI" IDRETRY newcheck MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$LSTR_ASK_EXIT_PSI" IDRETRY newcheck
; cancel ; cancel
Quit Quit
done: done:
Pop $0 ; restoring stack Pop $0 ; restoring stack
FunctionEnd FunctionEnd
Function un.InitRoutines Function un.InitRoutines
; MessageBox MB_OK "Uninstalling" ; MessageBox MB_OK "Uninstalling"
StrCmp $DONE_INIT "1" done_un_init StrCmp $DONE_INIT "1" done_un_init
StrCpy $DONE_INIT "1" StrCpy $DONE_INIT "1"
!insertmacro INIT_LANG_STRINGS !insertmacro INIT_LANG_STRINGS
; allow only one instance of the uninstaller ; allow only one instance of the uninstaller
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "psi${APPFULLVERSION}-uninstaller") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "psi${APPFULLVERSION}-uninstaller") i .r1 ?e'
Pop $R0 Pop $R0
StrCmp $R0 0 +3 StrCmp $R0 0 +3
MessageBox MB_OK "$LSTR_UNINST_RUNNING" MessageBox MB_OK "$LSTR_UNINST_RUNNING"
Abort Abort
;ask the user to close all psi instances on uninstall ;ask the user to close all psi instances on uninstall
Call un.ClosePsiInstances Call un.ClosePsiInstances
done_un_init: done_un_init:
FunctionEnd FunctionEnd
Function un.onInit Function un.onInit
; **************** ; ****************
;uninstall saved language setting ;uninstall saved language setting
!insertmacro MUI_UNGETLANGUAGE !insertmacro MUI_UNGETLANGUAGE
StrCpy $DONE_INIT "0" StrCpy $DONE_INIT "0"
FunctionEnd FunctionEnd
;Uninstall section ;Uninstall section
Section Uninstall Section Uninstall
;Remove from registry... ;Remove from registry...
Call un.IsUserAdmin Call un.IsUserAdmin
Pop $R0 Pop $R0
StrCmp $R0 "true" uninstall_is_admin StrCmp $R0 "true" uninstall_is_admin
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKCU "Software\Affinix\${APPNAME}" DeleteRegKey HKCU "Software\Affinix\${APPNAME}"
Goto uninstall_done Goto uninstall_done
uninstall_is_admin: uninstall_is_admin:
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM "Software\Affinix\${APPNAME}" DeleteRegKey HKLM "Software\Affinix\${APPNAME}"
uninstall_done: uninstall_done:
; Delete self ; Delete self
Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\uninstall.exe"
; Delete links ; Delete links
Delete "$INSTDIR\Psi - Forum.url"; Delete "$INSTDIR\Psi - Forum.url";
Delete "$INSTDIR\Psi - Home page.url"; Delete "$INSTDIR\Psi - Home page.url";
Delete "$INSTDIR\Psi - Documentation.url"; Delete "$INSTDIR\Psi - Documentation.url";
; Delete Shortcuts ; Delete Shortcuts
SetShellVarContext current SetShellVarContext current
Delete "$DESKTOP\Psi.lnk" Delete "$DESKTOP\Psi.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
Delete "$SMPROGRAMS\${APPNAME}\ReadME.lnk" Delete "$SMPROGRAMS\${APPNAME}\ReadME.lnk"
Delete "$QUICKLAUNCH\Psi.lnk" Delete "$QUICKLAUNCH\Psi.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi - Forum.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi - Forum.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi - Home page.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi - Home page.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi - Documentation.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi - Documentation.lnk"
RMDir "$SMPROGRAMS\${APPNAME}" RMDir "$SMPROGRAMS\${APPNAME}"
SetShellVarContext all SetShellVarContext all
Delete "$DESKTOP\Psi.lnk" Delete "$DESKTOP\Psi.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
Delete "$SMPROGRAMS\${APPNAME}\ReadME.lnk" Delete "$SMPROGRAMS\${APPNAME}\ReadME.lnk"
Delete "$QUICKLAUNCH\Psi.lnk" Delete "$QUICKLAUNCH\Psi.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi - Forum.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi - Forum.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi - Home page.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi - Home page.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Psi - Documentation.lnk" Delete "$SMPROGRAMS\${APPNAME}\Psi - Documentation.lnk"
RMDir "$SMPROGRAMS\${APPNAME}" RMDir "$SMPROGRAMS\${APPNAME}"
; DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Psi" ; DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Psi"
; ^ Registry shortcut doesn't work ; ^ Registry shortcut doesn't work
SetShellVarContext current SetShellVarContext current
Delete "$SMSTARTUP\Psi.lnk" Delete "$SMSTARTUP\Psi.lnk"
!ifdef BUILD_WITH_LANGPACKS !ifdef BUILD_WITH_LANGPACKS
; Delete Language files ; Delete Language files
!include "${APP_BUILD}psi_lang_uninstall.nsh" !include "${APP_BUILD}psi_lang_uninstall.nsh"
; See ReadME.txt for more information ; See ReadME.txt for more information
!endif !endif
; Clean up Psi (base) ; Clean up Psi (base)
!include "${APP_BUILD}psi_files_uninstall.nsh" !include "${APP_BUILD}psi_files_uninstall.nsh"
SectionEnd SectionEnd
Function UninstallPreviousPsi Function UninstallPreviousPsi
Call IsUserAdmin Call IsUserAdmin
Pop $R0 Pop $R0
StrCpy $RUN_BY_ADMIN $R0 ; saving information StrCpy $RUN_BY_ADMIN $R0 ; saving information
StrCmp $R0 "true" unppsi_is_admin StrCmp $R0 "true" unppsi_is_admin
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString"
ReadRegStr $R1 HKCU "Software\Affinix\${APPNAME}" "" ReadRegStr $R1 HKCU "Software\Affinix\${APPNAME}" ""
goto unppsi_done goto unppsi_done
unppsi_is_admin: unppsi_is_admin:
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString"
ReadRegStr $R1 HKLM "Software\Affinix\${APPNAME}" "" ReadRegStr $R1 HKLM "Software\Affinix\${APPNAME}" ""
unppsi_done: unppsi_done:
; $R0 holds the path to the uninstaller ; $R0 holds the path to the uninstaller
; $R1 holds the install dir ; $R1 holds the install dir
StrCmp $R0 "" auto_uninstall_done StrCmp $R0 "" auto_uninstall_done
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$LSTR_A_INSTALLED" \ MessageBox MB_YESNO|MB_ICONEXCLAMATION "$LSTR_A_INSTALLED" \
IDYES auto_uninstall_yes \ IDYES auto_uninstall_yes \
IDNO auto_uninstall_done IDNO auto_uninstall_done
;Run the uninstaller ;Run the uninstaller
auto_uninstall_yes: auto_uninstall_yes:
ClearErrors ClearErrors
ExecWait '$R0 /S _?=$INSTDIR' ExecWait '$R0 /S _?=$INSTDIR'
;Uninstall silently ;Uninstall silently
;Do not copy the uninstaller to a temp file ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller IfErrors no_remove_uninstaller
Goto auto_uninstall_done Goto auto_uninstall_done
no_remove_uninstaller: no_remove_uninstaller:
MessageBox MB_YESNO|MB_ICONQUESTION "$LSTR_ERR_UNINST" \ MessageBox MB_YESNO|MB_ICONQUESTION "$LSTR_ERR_UNINST" \
IDYES auto_uninstall_done \ IDYES auto_uninstall_done \
IDNO auto_uninstall_exit IDNO auto_uninstall_exit
auto_uninstall_exit: auto_uninstall_exit:
Quit Quit
auto_uninstall_done: auto_uninstall_done:
FunctionEnd FunctionEnd
; eof ; eof
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment