You are here

Windows NSI installer for coccinella

Hi,

I've made a nsi's script to build an installer for coccinella.

You can find it at the end of this post.

create a directory as follow :
+ coccinella
|- BIN
|- NSI
|- SRC

Where
BIN will contain the installer
NSI will contain the code below
SRC wil contain the uncompressed file downloaded there

Let me know if it was usefull or bugged


; Script generated with the Venis Install Wizard

; Define your application name
!define APPNAME "Coccinella Messenger"
!define APPNAMEANDVERSION "Coccinella Messenger 0.96.18"

; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Coccinella Messenger"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "..\BIN\${APPNAMEANDVERSION}.exe"

; Modern interface settings
!include "MUI.nsh"

!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\Coccinella Messenger-0.96.18.exe"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\SRC\Coccinella Messenger-0.96.18Win\COPYING.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_RESERVEFILE_LANGDLL

Section "Coccinella Messenger" Section1

; Set Section properties
SetOverwrite on

; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File "..\SRC\Coccinella Messenger-0.96.18Win\AUTHORS.txt"
File "..\SRC\Coccinella Messenger-0.96.18Win\CHANGES.txt"
File "..\SRC\Coccinella Messenger-0.96.18Win\COPYING.txt"
File "..\SRC\Coccinella Messenger-0.96.18Win\Coccinella Messenger-0.96.18.exe"
File "..\SRC\Coccinella Messenger-0.96.18Win\README.txt"
File "..\SRC\Coccinella Messenger-0.96.18Win\READMEs\FileTransferProtocol.txt"
File "..\SRC\Coccinella Messenger-0.96.18Win\READMEs\README-command-line"
File "..\SRC\Coccinella Messenger-0.96.18Win\READMEs\README-libraries"
File "..\SRC\Coccinella Messenger-0.96.18Win\READMEs\README-sounds"
File "..\SRC\Coccinella Messenger-0.96.18Win\READMEs\README-themes"
File "..\SRC\Coccinella Messenger-0.96.18Win\READMEs\README-web.html"
File "..\SRC\Coccinella Messenger-0.96.18Win\READMEs\README-xmpp"
CreateShortCut "$DESKTOP\Coccinella Messenger.lnk" "$INSTDIR\Coccinella Messenger-0.96.18.exe"
CreateDirectory "$SMPROGRAMS\Coccinella Messenger"
CreateShortCut "$SMPROGRAMS\Coccinella Messenger\Coccinella Messenger.lnk" "$INSTDIR\Coccinella Messenger-0.96.18.exe"
CreateShortCut "$SMPROGRAMS\Coccinella Messenger\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$QUICKLAUNCH\Coccinella Messenger.lnk" "$INSTDIR\Coccinella Messenger-0.96.18.exe"
CreateShortCut "$SMPROGRAMS\Coccinella Messenger\Read Me.lnk" "$INSTDIR\README.txt"

SectionEnd

Section -FinishSection

WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"

SectionEnd

; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} ""
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;Uninstall section
Section Uninstall

;Remove from registry...
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\${APPNAME}"

; Delete self
Delete "$INSTDIR\uninstall.exe"

; Delete Shortcuts
Delete "$DESKTOP\Coccinella Messenger.lnk"
Delete "$SMPROGRAMS\Coccinella Messenger\Coccinella Messenger.lnk"
Delete "$SMPROGRAMS\Coccinella Messenger\Uninstall.lnk"
Delete "$QUICKLAUNCH\Coccinella Messenger.lnk"
Delete "$SMPROGRAMS\Coccinella Messenger\Read Me.lnk"

; Clean up Coccinella Messenger
Delete "$INSTDIR\AUTHORS.txt"
Delete "$INSTDIR\CHANGES.txt"
Delete "$INSTDIR\COPYING.txt"
Delete "$INSTDIR\Coccinella Messenger-0.96.18.exe"
Delete "$INSTDIR\README.txt"
Delete "$INSTDIR\FileTransferProtocol.txt"
Delete "$INSTDIR\README-command-line"
Delete "$INSTDIR\README-libraries"
Delete "$INSTDIR\README-sounds"
Delete "$INSTDIR\README-themes"
Delete "$INSTDIR\README-web.html"
Delete "$INSTDIR\README-xmpp"

; Remove remaining directories
RMDir "$SMPROGRAMS\Coccinella Messenger"
RMDir "$INSTDIR\"

SectionEnd

; On initialization
Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

FunctionEnd

BrandingText "Coccinella Messenger"

; eof

see ya

Forum: 

Thanks for your contribution. It looks interesting. Should we provide such an installer besides/instead of the current Windows binary? What would be the advantage(s) over the current binary?

(I already found this useful tutorial: http://www.xdevsoftware.com/blog/post/How-to-Install-the-Nullsoft-Instal... )

I think it's more conveniant:
_ people is used to use "add/remove panel" ; simple usage
_ it reassuring to have an unistaller even if the binary exist.
_ finaly, I think it's a good thing that we can choose, between binary or installer

there may be other (dis)advantages bt that's all I can think of now.

I'm going to read you link : thanks!