Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Created June 12, 2019 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverca22/4cd94157def2e4db2b7c5b7eb8a9c99e to your computer and use it in GitHub Desktop.
Save cleverca22/4cd94157def2e4db2b7c5b7eb8a9c99e to your computer and use it in GitHub Desktop.
!Include MUI2.nsh
Var _1
Var _2
Var _10
Name "Daedalus (0.13.1)"
OutFile "daedalus-0.13.1-cardano-sl-3.0.1-mainnet-windows.exe"
!define MUI_ICON "icons\mainnet\mainnet.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "icons\installBanner.bmp"
!define MUI_HEADERIMAGE_RIGHT
VIProductVersion 0.0.0.0
VIAddVersionKey "ProductVersion" 0.13.1
Unicode true
RequestExecutionLevel Highest
!addplugindir "nsis_plugins\liteFirewall\bin"
InstallDir "$PROGRAMFILES64\Daedalus"
InstallDirRegKey HKLM "Software\Daedalus" "Install_Dir"
!define MUI_PAGE_CUSTOMFUNCTION_PRE PreDirectory
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Japanese"
LangString AlreadyRunning ${LANG_ENGLISH} "is running. It needs to be fully shut down before running the installer!"
LangString AlreadyRunning ${LANG_JAPANESE} "が起動中です。 インストーラーを実行する前に完全にシャットダウンする必要があります!"
Section "" _sec14
SectionIn RO
SetOutPath "$INSTDIR"
AllowSkipFiles off
WriteRegStr HKLM "Software\Daedalus" "Install_Dir" "$INSTDIR"
CreateDirectory "$APPDATA\Daedalus\Secrets-1.0"
CreateDirectory "$APPDATA\Daedalus\Logs"
CreateDirectory "$APPDATA\Daedalus\Logs\pub"
ClearErrors
Delete "$APPDATA\Daedalus\launcher.lock"
IfErrors 0 _lbl15
Abort " Daedalus$(AlreadyRunning)"
_lbl15:
IfFileExists "$APPDATA\Daedalus\Wallet-1.0\open\*.*" 0 _lbl19
RMDir "$APPDATA\Daedalus\Wallet-1.0\open"
_lbl19:
File "cardano-node.exe"
File "cardano-launcher.exe"
File "cardano-x509-certificates.exe"
File "log-config-prod.yaml"
File "wallet-topology.yaml"
File "configuration.yaml"
File "*genesis*.json"
File "launcher-config.yaml"
File /r "dlls\"
File /r "..\release\win32-x64\Daedalus-win32-x64\"
liteFirewall::AddRule "$INSTDIR\cardano-node.exe" "Cardano Node"
Pop $0
DetailPrint "liteFirewall::AddRule: $0"
CreateShortcut "$DESKTOP\Daedalus.lnk" "$INSTDIR\cardano-launcher.exe" "" "$INSTDIR\Daedalus.exe" "0" "SW_SHOWMINIMIZED" "" ""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "Publisher" "IOHK"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "ProductVersion" "0.13.1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "VersionMajor" "0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "VersionMinor" "0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "DisplayName" "Daedalus"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "DisplayVersion" "0.13.1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" \S"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Daedalus" "NoRepair" "1"
File "/build/uninstall.exe"
SectionEnd
Section "Start Menu Shortcuts" _sec23
CreateDirectory "$SMPROGRAMS\Daedalus"
CreateShortcut "$SMPROGRAMS\Daedalus\Uninstall Daedalus.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" "0" "" "" ""
CreateShortcut "$SMPROGRAMS\Daedalus\Daedalus.lnk" "$INSTDIR\cardano-launcher.exe" "" "$INSTDIR\Daedalus.exe" "0" "SW_SHOWMINIMIZED" "" ""
SectionEnd
Function .onInit
ReadRegStr $_1 HKLM "Software\Daedalus" "Install_Dir"
StrCpy $_2 "$_1"
FunctionEnd
Function PreDirectory
StrLen $_10 "$_2"
StrCmpS "$_10" "0" _lbl5 0
Abort ""
_lbl5:
FunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment