Created
October 30, 2017 11:16
-
-
Save rla/203bdd8e52ae1548b96409cf280b7dc3 to your computer and use it in GitHub Desktop.
Electron NSIS example (dist folder created with electron-packager)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!define setup "LCB-installer.exe" | |
!define company "Infdot" | |
!define prodname "LCB" | |
!define exec "LCB.exe" | |
!define srcdir "dist\LCB-win32-ia32" | |
!define regkey "Software\${company}\${prodname}" | |
!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" | |
!define startmenu "$SMPROGRAMS" | |
!include "MUI2.nsh" | |
Name "${prodname}" | |
OutFile "${setup}" | |
Icon "icon.ico" | |
InstallDir "$PROGRAMFILES\${company}\${prodname}" | |
InstallDirRegKey HKLM "${regkey}" "" | |
!define MUI_ABORTWARNING | |
!define MUI_FINISHPAGE_NOAUTOCLOSE | |
!insertmacro MUI_PAGE_INSTFILES | |
!insertmacro MUI_PAGE_FINISH | |
!insertmacro MUI_UNPAGE_CONFIRM | |
!insertmacro MUI_UNPAGE_INSTFILES | |
!insertmacro MUI_LANGUAGE "English" | |
Section "Copy files and create uninstaller" | |
SetOutPath "$INSTDIR" | |
File /r "${srcdir}\*.*" | |
File "icon.ico" | |
WriteUninstaller "$INSTDIR\uninstall.exe" | |
SectionEnd | |
Section "Write registry" | |
WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR" | |
WriteRegStr HKLM "${uninstkey}" "DisplayName" "${prodname} (remove)" | |
WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\uninstall.exe"' | |
WriteRegStr HKCR "${prodname}\DefaultIcon" "" "$INSTDIR\icon.ico" | |
SectionEnd | |
Section "Startmenu" | |
CreateShortCut "${startmenu}\${prodname}.lnk" "$INSTDIR\${exec}" "" "$INSTDIR\icon.ico" | |
CreateShortCut "$DESKTOP\${prodname}.lnk" "$INSTDIR\${exec}" "" "$INSTDIR\icon.ico" | |
SectionEnd | |
Section "Uninstall" | |
DeleteRegKey HKLM "${uninstkey}" | |
Delete "${startmenu}\${prodname}.lnk" | |
Delete "$DESKTOP\${prodname}.lnk" | |
RMDir /r /REBOOTOK $INSTDIR | |
SectionEnd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment