mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 06:03:24 +00:00
Created a modern windows installer script
The existing windows installer looks very archaic and offers very few configuration options. This script offers the following benefits: * A modern appearence using NSIS Modern UI 2.0 * Shows the GPL license before install * User can choose the target install folder * Stores chosen installation folder in registry * When installing a newer version on top of existing one, the existing installation folder is offered by default * It is possible to opt out of creating start menu shortcuts Additional bug fixes: * Added iconv.dll which was missing from the installer * Replaced all path separators with backwars slashes, so that the script works on both linux and windows Signed-Off-By: Ivan Habunek <ivan.habunek@gmail.com> Cleaned up whitespace Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
41d3a11ee3
commit
5cf89b4d28
1 changed files with 137 additions and 87 deletions
|
@ -1,105 +1,155 @@
|
|||
# this installer creator needs to be run with
|
||||
#
|
||||
# Subsurface NSIS installer script
|
||||
#
|
||||
# This installer creator needs to be run with:
|
||||
# makensis subsurface.nsi
|
||||
#
|
||||
# it assumes that packaging/windows/dll is a symlink to
|
||||
# It assumes that packaging/windows/dll is a symlink to
|
||||
# the directory in which the required Windows DLLs are installed
|
||||
# (in my case that's /usr/i686-w64-mingw32/sys-root/mingw/bin)
|
||||
#
|
||||
# define the name of the installer
|
||||
outfile "subsurface-installer.exe"
|
||||
Name subsurface
|
||||
|
||||
# some data for the package to identify itself
|
||||
VIProductVersion "1.1.9.0"
|
||||
VIAddVersionKey ProductName subsurface
|
||||
VIAddVersionKey FileDescription "subsurface diving log program"
|
||||
VIAddVersionKey LegalCopyright "GPL v.2"
|
||||
VIAddVersionKey ProductVersion "1.1"
|
||||
VIAddVersionKey FileVersion "1.1"
|
||||
#--------------------------------
|
||||
# Include Modern UI
|
||||
|
||||
# icon to use for the installer
|
||||
Icon .\subsurface.ico
|
||||
!include "MUI2.nsh"
|
||||
|
||||
# the installer needs to be run with admin privileges
|
||||
RequestExecutionLevel admin
|
||||
#--------------------------------
|
||||
# General
|
||||
|
||||
# pop up a little dialog that tells the user that we're about to
|
||||
# install subsurface
|
||||
Function .onInit
|
||||
MessageBox MB_YESNO "This will install subsurface. Do you wish to continue?" IDYES gogogo
|
||||
Abort
|
||||
gogogo:
|
||||
FunctionEnd
|
||||
|
||||
# define the directory to install to, the desktop in this case as specified
|
||||
# by the predefined $DESKTOP variable
|
||||
installDir "$PROGRAMFILES\subsurface"
|
||||
!define VERSION "1.1"
|
||||
|
||||
# Installer name and filename
|
||||
Name "Subsurface"
|
||||
Caption "Subsurface ${VERSION} Setup"
|
||||
OutFile "subsurface-${VERSION}.exe"
|
||||
|
||||
# Icon to use for the installer
|
||||
!define MUI_ICON "subsurface.ico"
|
||||
|
||||
# Default installation folder
|
||||
InstallDir "$PROGRAMFILES\Subsurface"
|
||||
|
||||
# Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\Subsurface" ""
|
||||
|
||||
# Request application privileges
|
||||
RequestExecutionLevel user
|
||||
|
||||
#--------------------------------
|
||||
# Settings
|
||||
|
||||
# Show a warn on aborting installation
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
# Defines the target start menu folder
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Subsurface"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
||||
|
||||
#--------------------------------
|
||||
# Variables
|
||||
|
||||
Var StartMenuFolder
|
||||
|
||||
#--------------------------------
|
||||
# Pages
|
||||
|
||||
# Installer pages
|
||||
!insertmacro MUI_PAGE_LICENSE "..\..\gpl-2.0.txt"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
# Uninstaller pages
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
#--------------------------------
|
||||
# Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
#--------------------------------
|
||||
# Default installer section
|
||||
|
||||
# default section
|
||||
Section
|
||||
|
||||
# define the output path for this file
|
||||
setOutPath $INSTDIR
|
||||
# Installation path
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
SetShellVarContext all
|
||||
# Files to include in installer
|
||||
file /oname=subsurface.exe ..\..\subsurface.exe
|
||||
file /oname=subsurface.ico subsurface.ico
|
||||
file /oname=subsurface.svg ..\..\subsurface.svg
|
||||
file /oname=libatk-1.0-0.dll dll\libatk-1.0-0.dll
|
||||
file /oname=libcairo-2.dll dll\libcairo-2.dll
|
||||
file /oname=libdivecomputer-0.dll dll\libdivecomputer-0.dll
|
||||
file /oname=libffi-6.dll dll\libffi-6.dll
|
||||
file /oname=libfontconfig-1.dll dll\libfontconfig-1.dll
|
||||
file /oname=libfreetype-6.dll dll\libfreetype-6.dll
|
||||
file /oname=libgdk_pixbuf-2.0-0.dll dll\libgdk_pixbuf-2.0-0.dll
|
||||
file /oname=libgdk-win32-2.0-0.dll dll\libgdk-win32-2.0-0.dll
|
||||
file /oname=libgio-2.0-0.dll dll\libgio-2.0-0.dll
|
||||
file /oname=libglib-2.0-0.dll dll\libglib-2.0-0.dll
|
||||
file /oname=libgmodule-2.0-0.dll dll\libgmodule-2.0-0.dll
|
||||
file /oname=libgobject-2.0-0.dll dll\libgobject-2.0-0.dll
|
||||
file /oname=libgthread-2.0-0.dll dll\libgthread-2.0-0.dll
|
||||
file /oname=libgtk-win32-2.0-0.dll dll\libgtk-win32-2.0-0.dll
|
||||
file /oname=libintl-8.dll dll\libintl-8.dll
|
||||
file /oname=libjasper-1.dll dll\libjasper-1.dll
|
||||
file /oname=libjpeg-62.dll dll\libjpeg-62.dll
|
||||
file /oname=libpango-1.0-0.dll dll\libpango-1.0-0.dll
|
||||
file /oname=libpangocairo-1.0-0.dll dll\libpangocairo-1.0-0.dll
|
||||
file /oname=libpangoft2-1.0-0.dll dll\libpangoft2-1.0-0.dll
|
||||
file /oname=libpangowin32-1.0-0.dll dll\libpangowin32-1.0-0.dll
|
||||
file /oname=libpixman-1-0.dll dll\libpixman-1-0.dll
|
||||
file /oname=libpng15-15.dll dll\libpng15-15.dll
|
||||
file /oname=libtiff-3.dll dll\libtiff-3.dll
|
||||
file /oname=libxml2-2.dll dll\libxml2-2.dll
|
||||
file /oname=libxslt-1.dll dll\libxslt-1.dll
|
||||
file /oname=pthreadGC2.dll dll\pthreadGC2.dll
|
||||
file /oname=zlib1.dll dll\zlib1.dll
|
||||
file /oname=libusb-1.0.dll dll\libusb-1.0.dll
|
||||
file /oname=SuuntoSDM.xslt ..\..\xslt\SuuntoSDM.xslt
|
||||
file /oname=jdivelog2subsurface.xslt ..\..\xslt\jdivelog2subsurface.xslt
|
||||
file /oname=iconv.dll dll\iconv.dll
|
||||
|
||||
# create directory in the Start menu
|
||||
CreateDirectory "$SMPROGRAMS\subsurface"
|
||||
# Store installation folder in registry
|
||||
WriteRegStr HKCU "Software\Subsurface" "" $INSTDIR
|
||||
|
||||
# create Start menu shortcut
|
||||
createShortCut "$SMPROGRAMS\subsurface\subsurface.lnk" "$INSTDIR\subsurface.exe"
|
||||
# Create shortcuts
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Subsurface.lnk" "$INSTDIR\subsurface.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Subsurface.lnk" "$INSTDIR\Uninstall.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
#create uninstaller and corresponding shortcut in Start menu
|
||||
writeUninstaller "$INSTDIR\subsurface-uninstall.exe"
|
||||
createShortCut "$SMPROGRAMS\subsurface\uninstall-subsurface.lnk" "$INSTDIR\subsurface-uninstall.exe"
|
||||
|
||||
# define what to install and place it in the output path
|
||||
file /oname=subsurface.exe ../../subsurface.exe
|
||||
file /oname=subsurface.ico subsurface.ico
|
||||
file /oname=subsurface.svg ../../subsurface.svg
|
||||
file /oname=libatk-1.0-0.dll dll/libatk-1.0-0.dll
|
||||
file /oname=libcairo-2.dll dll/libcairo-2.dll
|
||||
file /oname=libdivecomputer-0.dll dll\libdivecomputer-0.dll
|
||||
file /oname=libffi-5.dll dll\libffi-5.dll
|
||||
file /oname=libfontconfig-1.dll dll\libfontconfig-1.dll
|
||||
file /oname=libfreetype-6.dll dll\libfreetype-6.dll
|
||||
file /oname=libgdk_pixbuf-2.0-0.dll dll\libgdk_pixbuf-2.0-0.dll
|
||||
file /oname=libgdk-win32-2.0-0.dll dll\libgdk-win32-2.0-0.dll
|
||||
file /oname=libgio-2.0-0.dll dll\libgio-2.0-0.dll
|
||||
file /oname=libglib-2.0-0.dll dll\libglib-2.0-0.dll
|
||||
file /oname=libgmodule-2.0-0.dll dll\libgmodule-2.0-0.dll
|
||||
file /oname=libgobject-2.0-0.dll dll\libgobject-2.0-0.dll
|
||||
file /oname=libgthread-2.0-0.dll dll\libgthread-2.0-0.dll
|
||||
file /oname=libgtk-win32-2.0-0.dll dll\libgtk-win32-2.0-0.dll
|
||||
file /oname=libintl-8.dll dll\libintl-8.dll
|
||||
file /oname=libjasper-1.dll dll\libjasper-1.dll
|
||||
file /oname=libjpeg-8.dll dll\libjpeg-8.dll
|
||||
file /oname=libpango-1.0-0.dll dll\libpango-1.0-0.dll
|
||||
file /oname=libpangocairo-1.0-0.dll dll\libpangocairo-1.0-0.dll
|
||||
file /oname=libpangoft2-1.0-0.dll dll\libpangoft2-1.0-0.dll
|
||||
file /oname=libpangowin32-1.0-0.dll dll\libpangowin32-1.0-0.dll
|
||||
file /oname=libpixman-1-0.dll dll\libpixman-1-0.dll
|
||||
file /oname=libpng15-15.dll dll\libpng15-15.dll
|
||||
file /oname=libtiff-5.dll dll\libtiff-5.dll
|
||||
file /oname=libxml2-2.dll dll\libxml2-2.dll
|
||||
file /oname=libxslt-1.dll dll\libxslt-1.dll
|
||||
file /oname=pthreadGC2.dll dll\pthreadGC2.dll
|
||||
file /oname=zlib1.dll dll\zlib1.dll
|
||||
file /oname=libusb-1.0.dll dll\libusb-1.0.dll
|
||||
file /oname=SuuntoSDM.xslt ../../xslt/SuuntoSDM.xslt
|
||||
file /oname=jdivelog2subsurface.xslt ../../xslt/jdivelog2subsurface.xslt
|
||||
sectionEnd
|
||||
# Create the uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
section "uninstall"
|
||||
SetShellVarContext all
|
||||
delete "$INSTDIR\subsurface-uninstall.exe"
|
||||
delete "$INSTDIR\*.*"
|
||||
RMDir "$INSTDIR"
|
||||
delete "$SMPROGRAMS\subsurface\uninstall-subsurface.lnk"
|
||||
delete "$SMPROGRAMS\subsurface\subsurface.lnk"
|
||||
RMDir "$SMPROGRAMS\subsurface"
|
||||
SectionEnd
|
||||
|
||||
MessageBox MB_YESNO "Do you wish to keep subsurface's registry settings?" IDYES end
|
||||
DeleteRegKey HKCU "SOFTWARE\subsurface"
|
||||
end:
|
||||
sectionEnd
|
||||
#--------------------------------
|
||||
# Uninstaller section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
# Delete installed files
|
||||
Delete "$INSTDIR\*.dll"
|
||||
Delete "$INSTDIR\*.xslt"
|
||||
Delete "$INSTDIR\subsurface.exe"
|
||||
Delete "$INSTDIR\subsurface.ico"
|
||||
Delete "$INSTDIR\subsurface.svg"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
# Remove shortcuts
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\Subsurface.lnk"
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Subsurface.lnk"
|
||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||
|
||||
# Remove registry entries
|
||||
DeleteRegKey /ifempty HKCU "Software\Subsurface"
|
||||
|
||||
SectionEnd
|
||||
|
|
Loading…
Add table
Reference in a new issue