Warning, /pim/trojita/packaging/trojita.nsi is written in an unsupported language. File is not indexed.

0001 ;  Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
0002 ;
0003 ;  This file is part of the Trojita Qt IMAP e-mail client,
0004 ;  http://trojita.flaska.net/
0005 ;
0006 ;  This program is free software; you can redistribute it and/or
0007 ;  modify it under the terms of the GNU General Public License as
0008 ;  published by the Free Software Foundation; either version 2 of
0009 ;  the License or (at your option) version 3 or any later version
0010 ;  accepted by the membership of KDE e.V. (or its successor approved
0011 ;  by the membership of KDE e.V.), which shall act as a proxy
0012 ;  defined in Section 14 of version 3 of the license.
0013 ;
0014 ;  This program is distributed in the hope that it will be useful,
0015 ;  but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 ;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 ;  GNU General Public License for more details.
0018 ;
0019 ;  You should have received a copy of the GNU General Public License
0020 ;  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 ;
0022 
0023 ;--------------------------------
0024 
0025 !ifdef QUIET
0026 !verbose 2
0027 !endif
0028 
0029 ;--------------------------------
0030 
0031 !define redefine "!insertmacro redefine"
0032 !macro redefine symbol value
0033 !undef ${symbol}
0034 !define ${symbol} "${value}"
0035 !macroend
0036 
0037 ;--------------------------------
0038 
0039 !include "trojita-version.nsi"
0040 !include "trojita-files.nsi"
0041 
0042 ;--------------------------------
0043 
0044 !define NAME "Trojita"
0045 !define NAME_UNICODE "Trojitá"
0046 !define VERSION "${TROJITA_VERSION}"
0047 !define DESCRIPTION "Qt IMAP e-mail client"
0048 !define HOMEPAGE "http://trojita.flaska.net/"
0049 !define LICENSE "GPLv2/GPLv3"
0050 !define COPYRIGHT "https://commits.kde.org/trojita?path=LICENSE"
0051 
0052 ;--------------------------------
0053 
0054 !define ICON "${TROJITA_ICON_PATH}"
0055 !define EXE_PATH "${TROJITA_EXE_PATH}"
0056 !define EXE "${TROJITA_EXE}"
0057 !define UNINSTALL "uninstall.exe"
0058 !define INSTALLER "${NAME}-Setup.exe"
0059 !define INSTALLDIR "$PROGRAMFILES\${NAME}\"
0060 !define LANGUAGE "English"
0061 
0062 !ifdef x86_64
0063 ${redefine} INSTALLER "${NAME}-Setup-x86_64.exe"
0064 ${redefine} INSTALLDIR "$PROGRAMFILES64\${NAME}\"
0065 ${redefine} NAME "${NAME} (64 bit)"
0066 !endif
0067 
0068 !define REGKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
0069 
0070 ;--------------------------------
0071 
0072 Unicode true
0073 SetCompressor /SOLID /FINAL lzma
0074 Name "${NAME_UNICODE}"
0075 Icon "${ICON}"
0076 OutFile "${INSTALLER}"
0077 InstallDir "${INSTALLDIR}"
0078 InstallDirRegKey HKLM "${REGKEY}" "InstallLocation"
0079 BrandingText "${NAME_UNICODE} - ${DESCRIPTION}, version ${VERSION}  ${HOMEPAGE}"
0080 ShowInstDetails Show
0081 ShowUnInstDetails Show
0082 XPStyle on
0083 ManifestSupportedOS all
0084 RequestExecutionLevel admin
0085 
0086 ;--------------------------------
0087 
0088 !include "MUI2.nsh"
0089 
0090 ;--------------------------------
0091 
0092 Var STARTMENUDIR
0093 
0094 !define MUI_ICON "${ICON}"
0095 !define MUI_UNICON "${ICON}"
0096 
0097 !define MUI_ABORTWARNING
0098 !define MUI_FINISHPAGE_NOAUTOCLOSE
0099 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
0100 
0101 !insertmacro MUI_PAGE_WELCOME
0102 !insertmacro MUI_PAGE_DIRECTORY
0103 !insertmacro MUI_PAGE_STARTMENU Application $STARTMENUDIR
0104 !insertmacro MUI_PAGE_INSTFILES
0105 !insertmacro MUI_PAGE_FINISH
0106 
0107 !insertmacro MUI_UNPAGE_CONFIRM
0108 !insertmacro MUI_UNPAGE_INSTFILES
0109 !insertmacro MUI_UNPAGE_FINISH
0110 
0111 !insertmacro MUI_LANGUAGE "${LANGUAGE}"
0112 
0113 ;--------------------------------
0114 
0115 VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${NAME_UNICODE} Setup - ${DESCRIPTION}"
0116 VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VERSION}"
0117 VIAddVersionKey /LANG=${LANG_ENGLISH} "InternalName" "${NAME_UNICODE} Setup"
0118 VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${COPYRIGHT}"
0119 VIAddVersionKey /LANG=${LANG_ENGLISH} "License" "${LICENSE}"
0120 VIAddVersionKey /LANG=${LANG_ENGLISH} "Homepage" "${HOMEPAGE}"
0121 VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "${INSTALLER}"
0122 VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${NAME_UNICODE} Setup"
0123 VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${VERSION}"
0124 VIProductVersion "${TROJITA_VERNUM1}.${TROJITA_VERNUM2}.${TROJITA_VERNUM3}.${TROJITA_VERNUM4}"
0125 
0126 ;--------------------------------
0127 
0128 LangString INSTALLER_RUNNING ${LANG_ENGLISH} "${NAME_UNICODE} Setup is already running"
0129 LangString REMOVEPREVIOUS ${LANG_ENGLISH} "Removing previous installation"
0130 
0131 !ifdef x86_64
0132 LangString x86_64_ONLY ${LANG_ENGLISH} "This version is for 64 bits computers only"
0133 !endif
0134 
0135 ;--------------------------------
0136 
0137 Function .onInit
0138 
0139         System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e'
0140         Pop $0
0141         StrCmp $0 0 +3
0142 
0143         MessageBox MB_OK|MB_ICONEXCLAMATION "$(INSTALLER_RUNNING)"
0144         Abort
0145 
0146 !ifdef x86_64
0147 
0148         System::Call "kernel32::GetCurrentProcess() i .s"
0149         System::Call "kernel32::IsWow64Process(i s, *i .r0)"
0150         IntCmp $0 0 0 0 +3
0151 
0152         MessageBox MB_OK|MB_ICONSTOP "$(x86_64_ONLY)"
0153         Abort
0154 
0155 !endif
0156 
0157 FunctionEnd
0158 
0159 ;--------------------------------
0160 
0161 Section "-${NAME}" UninstallPrevious
0162 
0163         SectionIn RO
0164 
0165         ReadRegStr $0 HKLM "${REGKEY}" "InstallLocation"
0166         StrCmp $0 "" +7
0167 
0168         DetailPrint "$(REMOVEPREVIOUS)"
0169         SetDetailsPrint none
0170         ExecWait "$0\${UNINSTALL} /S _?=$0"
0171         Delete "$0\${UNINSTALL}"
0172         RMDir $0
0173         SetDetailsPrint lastused
0174 
0175 SectionEnd
0176 
0177 Section "${NAME}"
0178 
0179         SectionIn RO
0180 
0181         SetOutPath "$INSTDIR"
0182         File "${EXE_PATH}"
0183         !insertmacro TROJITA_INSTALL_FILES
0184 
0185         !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
0186         CreateDirectory "$SMPROGRAMS\$STARTMENUDIR"
0187         CreateShortCut "$SMPROGRAMS\$STARTMENUDIR\${NAME_UNICODE}.lnk" "$INSTDIR\${EXE}"
0188         CreateShortCut "$SMPROGRAMS\$STARTMENUDIR\Uninstall.lnk" "$INSTDIR\${UNINSTALL}"
0189         CreateShortcut "$DESKTOP\${NAME_UNICODE}.lnk" "$INSTDIR\${EXE}"
0190         !insertmacro MUI_STARTMENU_WRITE_END
0191 
0192         WriteRegStr HKLM "${REGKEY}" "DisplayName" "${NAME_UNICODE} - ${DESCRIPTION}"
0193         WriteRegStr HKLM "${REGKEY}" "UninstallString" "$\"$INSTDIR\${UNINSTALL}$\""
0194         WriteRegStr HKLM "${REGKEY}" "QuietUninstallString" "$\"$INSTDIR\${UNINSTALL}$\" /S"
0195         WriteRegStr HKLM "${REGKEY}" "InstallLocation" "$INSTDIR"
0196         WriteRegStr HKLM "${REGKEY}" "DisplayIcon" "$\"$INSTDIR\${EXE}$\",0"
0197         WriteRegStr HKLM "${REGKEY}" "DisplayVersion" "${VERSION}"
0198         WriteRegStr HKLM "${REGKEY}" "HelpLink" "${HOMEPAGE}"
0199         WriteRegStr HKLM "${REGKEY}" "URLUpdateInfo" "${HOMEPAGE}"
0200         WriteRegStr HKLM "${REGKEY}" "URLInfoAbout" "${HOMEPAGE}"
0201         WriteRegDWORD HKLM "${REGKEY}" "NoModify" 1
0202         WriteRegDWORD HKLM "${REGKEY}" "NoRepair" 1
0203 
0204         WriteUninstaller "$INSTDIR\${UNINSTALL}"
0205 
0206 SectionEnd
0207 
0208 ;--------------------------------
0209 
0210 Section "un.${NAME}"
0211 
0212         SectionIn RO
0213 
0214         !insertmacro MUI_STARTMENU_GETFOLDER Application $STARTMENUDIR
0215         Delete "$SMPROGRAMS\$STARTMENUDIR\${NAME_UNICODE}.lnk"
0216         Delete "$SMPROGRAMS\$STARTMENUDIR\Uninstall.lnk"
0217         RMDir "$SMPROGRAMS\$STARTMENUDIR"
0218         Delete "$DESKTOP\${NAME_UNICODE}.lnk"
0219 
0220         Delete "$INSTDIR\${EXE}"
0221         !insertmacro TROJITA_UNINSTALL_FILES
0222 
0223         DeleteRegKey HKLM "${REGKEY}"
0224 
0225         Delete "$INSTDIR\${UNINSTALL}"
0226         RMDir "$INSTDIR"
0227 
0228 SectionEnd
0229 
0230 ;--------------------------------