Jump to content
Ketarin forum

Windows NSI installer script


deogracia
 Share

Recommended Posts

Hi,

I wrote a NSI's script to install Ketrain.

 

Create à directory as is :

 

+ Ketarin

| bin

| license

| nsi

| setup

 

_ extract the content of the archive you download in "bin"

_ put the licence.txt file (I haven't found one on the website) in "license"

_ put the script below in "nsi"

_ and the setup will be create automatically in "setup"

 

 

 

; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Ketarin"
!define PRODUCT_VERSION "1.1.0.331"
!define PRODUCT_PUBLISHER "Canneverbe Limited"
!define PRODUCT_WEB_SITE "http://ketarin.canneverbe.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Ketarin.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"

; set owner
BrandingText "Canneverbe Limited"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "..\licence\licence.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\Ketarin.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "..\setup\${PRODUCT_NAME}_${PRODUCT_VERSION}.exe"
InstallDir "$PROGRAMFILES\Ketarin"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Function .onInit
 !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

Section "SectionPrincipale" SEC01
 SetOutPath "$INSTDIR"
 SetOverwrite ifnewer
 File "..\bin\Ketarin.exe"
 CreateDirectory "$SMPROGRAMS\Ketarin"
 CreateShortCut "$SMPROGRAMS\Ketarin\Ketarin.lnk" "$INSTDIR\Ketarin.exe"
 CreateShortCut "$DESKTOP\Ketarin.lnk" "$INSTDIR\Ketarin.exe"
 File "..\bin\System.Data.SQLite.DLL"
SectionEnd

Section -AdditionalIcons
 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
 CreateShortCut "$SMPROGRAMS\Ketarin\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
 CreateShortCut "$SMPROGRAMS\Ketarin\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
 WriteUninstaller "$INSTDIR\uninst.exe"
 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Ketarin.exe"
 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Ketarin.exe"
 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
 HideWindow
 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) a été désinstallé avec succès de votre ordinateur."
FunctionEnd

Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Êtes-vous certains de vouloir désinstaller totalement $(^Name) et tous ses composants ?" IDYES +2
 Abort
FunctionEnd

Section Uninstall
 Delete "$INSTDIR\${PRODUCT_NAME}.url"
 Delete "$INSTDIR\uninst.exe"
 Delete "$INSTDIR\System.Data.SQLite.DLL"
 Delete "$INSTDIR\Ketarin.exe"

 Delete "$SMPROGRAMS\Ketarin\Uninstall.lnk"
 Delete "$SMPROGRAMS\Ketarin\Website.lnk"
 Delete "$DESKTOP\Ketarin.lnk"
 Delete "$SMPROGRAMS\Ketarin\Ketarin.lnk"

 RMDir "$SMPROGRAMS\Ketarin"
 RMDir "$INSTDIR"

 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
 SetAutoClose true
SectionEnd

 

tell me if it was useful to you.

 

See ya.

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.