mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
226 lines
6.7 KiB
Text
226 lines
6.7 KiB
Text
|
############################################################################################
|
|||
|
# NSIS Installation Script created by NSIS Quick Setup Script Generator v1.09.18
|
|||
|
# Entirely Edited with NullSoft Scriptable Installation System
|
|||
|
# by Vlasis K. Barkas aka Red Wine red_wine@freemail.gr Sep 2006
|
|||
|
############################################################################################
|
|||
|
|
|||
|
!define APP_NAME "nheko"
|
|||
|
!define COMP_NAME "mujx"
|
|||
|
!define WEB_SITE "https://github.com/mujx/nheko"
|
|||
|
!define VERSION "0.1.0.0"
|
|||
|
!define COPYRIGHT "mujx <20> 2017"
|
|||
|
!define DESCRIPTION "Desktop client for the Matrix protocol"
|
|||
|
!define LICENSE_TXT "LICENSE.txt"
|
|||
|
!define INSTALLER_NAME "..\..\nheko_setup.exe"
|
|||
|
!define INPUT_DIR "..\..\NhekoRelease"
|
|||
|
!define MAIN_APP_EXE "nheko.exe"
|
|||
|
!define INSTALL_TYPE "SetShellVarContext all"
|
|||
|
!define REG_ROOT "HKLM"
|
|||
|
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
|
|||
|
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
|||
|
|
|||
|
!define REG_START_MENU "Start Menu Folder"
|
|||
|
|
|||
|
var SM_Folder
|
|||
|
|
|||
|
######################################################################
|
|||
|
|
|||
|
VIProductVersion "${VERSION}"
|
|||
|
VIAddVersionKey "ProductName" "${APP_NAME}"
|
|||
|
VIAddVersionKey "CompanyName" "${COMP_NAME}"
|
|||
|
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
|
|||
|
VIAddVersionKey "FileDescription" "${DESCRIPTION}"
|
|||
|
VIAddVersionKey "FileVersion" "${VERSION}"
|
|||
|
|
|||
|
######################################################################
|
|||
|
|
|||
|
SetCompressor ZLIB
|
|||
|
Name "${APP_NAME}"
|
|||
|
Caption "${APP_NAME}"
|
|||
|
OutFile "${INSTALLER_NAME}"
|
|||
|
BrandingText "${APP_NAME}"
|
|||
|
XPStyle on
|
|||
|
InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
|
|||
|
InstallDir "$PROGRAMFILES\nheko"
|
|||
|
|
|||
|
######################################################################
|
|||
|
|
|||
|
!include "MUI.nsh"
|
|||
|
|
|||
|
!define MUI_ICON "..\..\resources\nheko.ico"
|
|||
|
!define MUI_HEADERIMAGE
|
|||
|
!define MUI_HEADERIMAGE_BITMAP "..\..\resources\nheko.bmp"
|
|||
|
!define MUI_HEADERIMAGE_RIGHT
|
|||
|
|
|||
|
!define MUI_ABORTWARNING
|
|||
|
!define MUI_UNABORTWARNING
|
|||
|
|
|||
|
!insertmacro MUI_PAGE_WELCOME
|
|||
|
|
|||
|
!ifdef LICENSE_TXT
|
|||
|
!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}"
|
|||
|
!endif
|
|||
|
|
|||
|
!insertmacro MUI_PAGE_DIRECTORY
|
|||
|
|
|||
|
!ifdef REG_START_MENU
|
|||
|
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "nheko"
|
|||
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}"
|
|||
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
|
|||
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}"
|
|||
|
!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder
|
|||
|
!endif
|
|||
|
|
|||
|
!insertmacro MUI_PAGE_INSTFILES
|
|||
|
|
|||
|
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAIN_APP_EXE}"
|
|||
|
!insertmacro MUI_PAGE_FINISH
|
|||
|
|
|||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|||
|
|
|||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|||
|
|
|||
|
!insertmacro MUI_UNPAGE_FINISH
|
|||
|
|
|||
|
!insertmacro MUI_LANGUAGE "English"
|
|||
|
|
|||
|
######################################################################
|
|||
|
|
|||
|
Section -MainProgram
|
|||
|
${INSTALL_TYPE}
|
|||
|
SetOverwrite ifnewer
|
|||
|
SetOutPath "$INSTDIR"
|
|||
|
File /r "${INPUT_DIR}\*"
|
|||
|
SectionEnd
|
|||
|
|
|||
|
######################################################################
|
|||
|
|
|||
|
Section -Icons_Reg
|
|||
|
SetOutPath "$INSTDIR"
|
|||
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|||
|
|
|||
|
!ifdef REG_START_MENU
|
|||
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
|||
|
CreateDirectory "$SMPROGRAMS\$SM_Folder"
|
|||
|
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
|
|||
|
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
|
|||
|
CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
|||
|
|
|||
|
!ifdef WEB_SITE
|
|||
|
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
|
|||
|
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
|
|||
|
!endif
|
|||
|
!insertmacro MUI_STARTMENU_WRITE_END
|
|||
|
!endif
|
|||
|
|
|||
|
!ifndef REG_START_MENU
|
|||
|
CreateDirectory "$SMPROGRAMS\nheko"
|
|||
|
CreateShortCut "$SMPROGRAMS\nheko\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
|
|||
|
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
|
|||
|
CreateShortCut "$SMPROGRAMS\nheko\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
|||
|
|
|||
|
!ifdef WEB_SITE
|
|||
|
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
|
|||
|
CreateShortCut "$SMPROGRAMS\nheko\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
|
|||
|
!endif
|
|||
|
!endif
|
|||
|
|
|||
|
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
|
|||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
|
|||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
|
|||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
|
|||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
|
|||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
|
|||
|
|
|||
|
!ifdef WEB_SITE
|
|||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}"
|
|||
|
!endif
|
|||
|
SectionEnd
|
|||
|
|
|||
|
######################################################################
|
|||
|
|
|||
|
Section Uninstall
|
|||
|
${INSTALL_TYPE}
|
|||
|
|
|||
|
########
|
|||
|
|
|||
|
!macro BadPathsCheck
|
|||
|
StrCpy $R0 $INSTDIR "" -2
|
|||
|
StrCmp $R0 ":\" bad
|
|||
|
StrCpy $R0 $INSTDIR "" -14
|
|||
|
StrCmp $R0 "\Program Files" bad
|
|||
|
StrCpy $R0 $INSTDIR "" -8
|
|||
|
StrCmp $R0 "\Windows" bad
|
|||
|
StrCpy $R0 $INSTDIR "" -6
|
|||
|
StrCmp $R0 "\WinNT" bad
|
|||
|
StrCpy $R0 $INSTDIR "" -9
|
|||
|
StrCmp $R0 "\system32" bad
|
|||
|
StrCpy $R0 $INSTDIR "" -8
|
|||
|
StrCmp $R0 "\Desktop" bad
|
|||
|
StrCpy $R0 $INSTDIR "" -23
|
|||
|
StrCmp $R0 "\Documents and Settings" bad
|
|||
|
StrCpy $R0 $INSTDIR "" -13
|
|||
|
StrCmp $R0 "\My Documents" bad done
|
|||
|
bad:
|
|||
|
MessageBox MB_OK|MB_ICONSTOP "Install path invalid!"
|
|||
|
Abort
|
|||
|
done:
|
|||
|
!macroend
|
|||
|
|
|||
|
StrCmp $INSTDIR "" 0 +2
|
|||
|
StrCpy $INSTDIR $EXEDIR
|
|||
|
|
|||
|
# Check that the uninstall isn't dangerous.
|
|||
|
!insertmacro BadPathsCheck
|
|||
|
|
|||
|
# Does path end with "\nheko"?
|
|||
|
!define CHECK_PATH "\nheko"
|
|||
|
StrLen $R1 "${CHECK_PATH}"
|
|||
|
StrCpy $R0 $INSTDIR "" -$R1
|
|||
|
StrCmp $R0 "${CHECK_PATH}" +3
|
|||
|
MessageBox MB_YESNO|MB_ICONQUESTION "Unrecognised uninstall path. Continue anyway?" IDYES +2
|
|||
|
Abort
|
|||
|
|
|||
|
IfFileExists "$INSTDIR\*.*" 0 +2
|
|||
|
IfFileExists "$INSTDIR\nheko.exe" +3
|
|||
|
MessageBox MB_OK|MB_ICONSTOP "Install path invalid!"
|
|||
|
Abort
|
|||
|
|
|||
|
########
|
|||
|
|
|||
|
RMDir /r /REBOOTOK $INSTDIR
|
|||
|
|
|||
|
Delete "$INSTDIR\uninstall.exe"
|
|||
|
!ifdef WEB_SITE
|
|||
|
Delete "$INSTDIR\${APP_NAME} website.url"
|
|||
|
!endif
|
|||
|
|
|||
|
!ifdef REG_START_MENU
|
|||
|
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
|
|||
|
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk"
|
|||
|
Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk"
|
|||
|
!ifdef WEB_SITE
|
|||
|
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk"
|
|||
|
!endif
|
|||
|
Delete "$DESKTOP\${APP_NAME}.lnk"
|
|||
|
|
|||
|
RmDir "$SMPROGRAMS\$SM_Folder"
|
|||
|
!endif
|
|||
|
|
|||
|
!ifndef REG_START_MENU
|
|||
|
Delete "$SMPROGRAMS\nheko\${APP_NAME}.lnk"
|
|||
|
Delete "$SMPROGRAMS\nheko\Uninstall ${APP_NAME}.lnk"
|
|||
|
!ifdef WEB_SITE
|
|||
|
Delete "$SMPROGRAMS\nheko\${APP_NAME} Website.lnk"
|
|||
|
!endif
|
|||
|
Delete "$DESKTOP\${APP_NAME}.lnk"
|
|||
|
|
|||
|
RmDir "$SMPROGRAMS\nheko"
|
|||
|
!endif
|
|||
|
|
|||
|
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
|
|||
|
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
|
|||
|
SectionEnd
|
|||
|
|
|||
|
######################################################################
|