1# NSIS script creating the Windows installer for glogg 2 3# Is passed to the script using -DVERSION=$(git describe) on the command line 4!ifndef VERSION 5 !define VERSION 'anonymous-build' 6!endif 7 8# Headers 9!include "MUI2.nsh" 10!include "FileAssociation.nsh" 11 12# General 13OutFile "glogg-${VERSION}-setup.exe" 14 15XpStyle on 16 17SetCompressor /SOLID lzma 18 19; Registry key to keep track of the directory we are installed in 20InstallDir "$PROGRAMFILES\glogg" 21InstallDirRegKey HKLM Software\glogg "" 22 23; glogg icon 24; !define MUI_ICON glogg.ico 25 26RequestExecutionLevel admin 27 28Name "glogg" 29Caption "glogg ${VERSION} Setup" 30 31# Pages 32!define MUI_WELCOMEPAGE_TITLE "Welcome to the glogg ${VERSION} Setup Wizard" 33!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of glogg\ 34, a fast, advanced log explorer.$\r$\n$\r$\n\ 35glogg and the Qt libraries are released under the GPL, see \ 36the COPYING file.$\r$\n$\r$\n$_CLICK" 37; MUI_FINISHPAGE_LINK_LOCATION "http://nsis.sf.net/" 38 39!insertmacro MUI_PAGE_WELCOME 40;!insertmacro MUI_PAGE_LICENSE "COPYING" 41# !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD... 42!insertmacro MUI_PAGE_COMPONENTS 43!insertmacro MUI_PAGE_DIRECTORY 44!insertmacro MUI_PAGE_INSTFILES 45!insertmacro MUI_PAGE_FINISH 46 47!insertmacro MUI_UNPAGE_WELCOME 48!insertmacro MUI_UNPAGE_CONFIRM 49!insertmacro MUI_UNPAGE_INSTFILES 50!insertmacro MUI_UNPAGE_FINISH 51 52# Languages 53!insertmacro MUI_LANGUAGE "English" 54 55# Installer sections 56Section "glogg" glogg 57 ; Prevent this section from being unselected 58 SectionIn RO 59 60 SetOutPath $INSTDIR 61 File release\glogg.exe 62 File COPYING 63 File README 64 65 ; Create the 'sendto' link 66 CreateShortCut "$SENDTO\glogg.lnk" "$INSTDIR\glogg,exe" "" "$INSTDIR\glogg.exe" 0 67 68 ; Register as an otion (but not main handler) for some files (.txt, .Log, .cap) 69 WriteRegStr HKCR "Applications\glogg.exe" "" "" 70 WriteRegStr HKCR "Applications\glogg.exe\shell" "" "open" 71 WriteRegStr HKCR "Applications\glogg.exe\shell\open" "FriendlyAppName" "glogg" 72 WriteRegStr HKCR "Applications\glogg.exe\shell\open\command" "" '"$INSTDIR\glogg.exe" "%1"' 73 WriteRegStr HKCR "*\OpenWithList\glogg.exe" "" "" 74 WriteRegStr HKCR ".txt\OpenWithList\glogg.exe" "" "" 75 WriteRegStr HKCR ".Log\OpenWithList\glogg.exe" "" "" 76 WriteRegStr HKCR ".cap\OpenWithList\glogg.exe" "" "" 77 78 ; Register uninstaller 79 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\ 80"UninstallString" '"$INSTDIR\Uninstall.exe"' 81 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\ 82"InstallLocation" "$INSTDIR" 83 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayName" "glogg" 84 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayVersion" "${VERSION}" 85 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoModify" "1" 86 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoRepair" "1" 87 88 ; Create uninstaller 89 WriteUninstaller "$INSTDIR\Uninstall.exe" 90SectionEnd 91 92Section "Qt4 Runtime libraries" qtlibs 93 SetOutPath $INSTDIR 94 File release\QtCore4.dll 95 File release\QtGui4.dll 96SectionEnd 97 98Section "Create Start menu shortcut" shortcut 99 SetShellVarContext all 100 CreateShortCut "$SMPROGRAMS\glogg.lnk" "$INSTDIR\glogg.exe" "" "$INSTDIR\glogg.exe" 0 101SectionEnd 102 103Section /o "Associate with .log files" associate 104 ${registerExtension} "$INSTDIR\glogg.exe" ".log" "Log file" 105SectionEnd 106 107# Descriptions 108!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN 109 !insertmacro MUI_DESCRIPTION_TEXT ${glogg} "The core files required to use glogg." 110 !insertmacro MUI_DESCRIPTION_TEXT ${qtlibs} "Needed by glogg, you have to install these unless \ 111you already have the Qt4 development kit installed." 112 !insertmacro MUI_DESCRIPTION_TEXT ${shortcut} "Create a shortcut in the Start menu for glogg." 113 !insertmacro MUI_DESCRIPTION_TEXT ${associate} "Make glogg the default viewer for .log files." 114!insertmacro MUI_FUNCTION_DESCRIPTION_END 115 116# Uninstaller 117Section "Uninstall" 118 Delete "$INSTDIR\Uninstall.exe" 119 120 Delete "$INSTDIR\glogg.exe" 121 Delete "$INSTDIR\README" 122 Delete "$INSTDIR\COPYING" 123 Delete "$INSTDIR\mingwm10.dll" 124 Delete "$INSTDIR\libgcc_s_dw2-1.dll" 125 Delete "$INSTDIR\QtCore4.dll" 126 Delete "$INSTDIR\QtGui4.dll" 127 RMDir "$INSTDIR" 128 129 ; Remove settings in %appdata% 130 Delete "$APPDATA\glogg\glogg.ini" 131 RMDir "$APPDATA\glogg" 132 133 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" 134 135 ; Remove settings in the registry (from glogg < 0.9) 136 DeleteRegKey HKCU "Software\glogg" 137 138 ; Remove the file associations 139 ${unregisterExtension} ".log" "Log file" 140 141 DeleteRegKey HKCR "*\OpenWithList\glogg.exe" 142 DeleteRegKey HKCR ".txt\OpenWithList\glogg.exe" 143 DeleteRegKey HKCR ".Log\OpenWithList\glogg.exe" 144 DeleteRegKey HKCR ".cap\OpenWithList\glogg.exe" 145 DeleteRegKey HKCR "Applications\glogg.exe\shell\open\command" 146 DeleteRegKey HKCR "Applications\glogg.exe\shell\open" 147 DeleteRegKey HKCR "Applications\glogg.exe\shell" 148 DeleteRegKey HKCR "Applications\glogg.exe" 149 150 ; Remove the shortcut, if any 151 SetShellVarContext all 152 Delete "$SMPROGRAMS\glogg.lnk" 153SectionEnd 154