Skip to content

Commit

Permalink
Update NSIS installer script (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
bovirus authored Aug 18, 2024
1 parent 8d0e72c commit 2c1b17f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 27 deletions.
92 changes: 69 additions & 23 deletions FastFlix.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,35 @@

!include "MUI2.nsh"
!include LogicLib.nsh
!include "TextFunc.nsh"
!include "FileFunc.nsh"

;--------------------------------

!define PRODUCT_NAME "FastFlix"
!define VERSION "5.8.0"
!define PRODUCT_VERSION "5.8.0.0"
!define PRODUCT_AUTHOR "Chris Griffith"
!define PRODUCT_COPYRIGHT "(c) Chris Griffith 2021-2024"

VIProductVersion "${PRODUCT_VERSION}"
VIFileVersion "${PRODUCT_VERSION}"

; -------------------------------------------------------------------- Installer exe properties

VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "CompanyName" "${PRODUCT_AUTHOR}"
VIAddVersionKey "LegalTrademarks" "${PRODUCT_COPYRIGHT}"
VIAddVersionKey "LegalCopyright" "${PRODUCT_COPYRIGHT}"
VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "FileDescription" "${PRODUCT_NAME} installer"

VIAddVersionKey "InternalName" "${PRODUCT_NAME}"


; The name of the installer
Name "FastFlix"
Name "${PRODUCT_NAME} ${VERSION}"

; The file to write
OutFile "FastFlix_installer.exe"
Expand All @@ -20,10 +45,10 @@ Unicode True
SetCompressor lzma

; The default installation directory
InstallDir $PROGRAMFILES64\FastFlix
InstallDir $PROGRAMFILES64\${PRODUCT_NAME}

; Registry key to check for directory (so if you install again, it will overwrite the old one automatically)
InstallDirRegKey HKLM "Software\FastFlix" "Install_Dir"
InstallDirRegKey HKLM "Software\${PRODUCT_NAME}" "Install_Dir"

;--------------------------------

Expand All @@ -36,55 +61,76 @@ InstallDirRegKey HKLM "Software\FastFlix" "Install_Dir"

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_FINISHPAGE_TEXT "Thank you for installing FastFlix!"
!define MUI_FINISHPAGE_TEXT "$(LSTR05)"
!insertmacro MUI_PAGE_FINISH


;Languages

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Italian"

LangString LSTR01 1033 "Before proceeding with the installation of ${PRODUCT_NAME} you must uninstall the currently installed version.$\r$\n$\r$\nPlease ensure that ${PRODUCT_NAME} is not currently running!"
LangString LSTR02 1033 "FastFlix (required)"
LangString LSTR03 1033 "Start Menu Shortcuts"
LangString LSTR04 1033 "Uninstall"
LangString LSTR05 1033 "Thank you for installing ${PRODUCT_NAME}!"

LangString LSTR01 1040 "Prima di procedere all'installazione di ${PRODUCT_NAME} è necessario disinstallare la versione attualmente installata.$\r$\n$\r$\nAssicurati che ${PRODUCT_NAME} non sia attualmente in esecuzione!"
LangString LSTR02 1040 "FastFlix (richiesto)"
LangString LSTR03 1040 "Collegamenti menu Start"
LangString LSTR04 1040 "Disinstalla"
LangString LSTR05 1040 "Grazie per aver installato ${PRODUCT_NAME}!"


;--------------------------------
Function .onInit
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FastFlix" "UninstallString"
${If} $0 != ""
Messagebox MB_OK|MB_ICONINFORMATION "You will now be prompted to first uninstall the previous version of FastFlix. Please ensure it is not currently running!"
Messagebox MB_OK|MB_ICONINFORMATION "$(LSTR01)"
ExecWait '$0 _?=$INSTDIR'
${EndIf}
FunctionEnd


; The stuff to install
Section "FastFlix (required)"
Section "$(LSTR02)"

SectionIn RO

; Set output path to the installation directory.
SetOutPath $INSTDIR


Delete "$INSTDIR\uninstall.exe"
; Put file there
File /r "dist\FastFlix\*"
File /r "dist\${PRODUCT_NAME}\*"

; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\FastFlix "Install_Dir" "$INSTDIR"
WriteRegStr HKLM SOFTWARE\FastFlix "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "Install_Dir" "$INSTDIR"
WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "UninstallString" '"$INSTDIR\uninstall.exe"'

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FastFlix" "DisplayName" "FastFlix"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FastFlix" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FastFlix" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FastFlix" "NoRepair" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "${PRODUCT_AUTHOR}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\FastFlix.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" 1

${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0 #< conv to DWORD
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "EstimatedSize" "$0"

WriteUninstaller "$INSTDIR\uninstall.exe"

SectionEnd

; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
Section "$(LSTR03)"

CreateDirectory "$SMPROGRAMS\FastFlix"
CreateShortcut "$SMPROGRAMS\FastFlix\FastFlix.lnk" "$INSTDIR\FastFlix.exe"
CreateShortcut "$SMPROGRAMS\FastFlix\Uninstall FastFlix.lnk" "$INSTDIR\uninstall.exe"
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortcut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\FastFlix.exe"
CreateShortcut "$SMPROGRAMS\${PRODUCT_NAME}\$(LSTR04) ${PRODUCT_NAME}.lnk" "$INSTDIR\uninstall.exe"

SectionEnd

Expand All @@ -93,17 +139,17 @@ SectionEnd
Section "Uninstall"

; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FastFlix"
DeleteRegKey HKLM SOFTWARE\FastFlix
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME}

; Remove files
Delete $INSTDIR\*

; Remove shortcuts, if any
Delete "$SMPROGRAMS\FastFlix\*.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.lnk"

; Remove directories
RMDir "$SMPROGRAMS\FastFlix"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
RMDir /r "$INSTDIR"
RMDir "$INSTDIR"

Expand Down
8 changes: 4 additions & 4 deletions fastflix/data/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Add to Queue:
deu: Zur Warteschlange hinzufügen
eng: Add to Queue
fra: Ajouter à la file d'attente
ita: Aggiungi alla coda
ita: Aggiungi a coda
spa: Añadir a la cola
chs: 添加到队列
jpn: キューに追加
Expand Down Expand Up @@ -1888,7 +1888,7 @@ Encoder Output:
deu: Kodierer-Ausgabe
eng: Encoder Output
fra: Sortie de l'encodeur
ita: Uscita encoder
ita: Output encoder
spa: Salida del codificador
chs: 编码器输出
jpn: エンコーダ出力
Expand Down Expand Up @@ -3277,7 +3277,7 @@ No Flip:
deu: Keine Spiegelung
eng: No Flip
fra: Pas de retournement
ita: Senza capovolgere
ita: Non capovolgere
spa: No hay vuelta atrás
chs: 无翻转
jpn: 反転なし
Expand All @@ -3292,7 +3292,7 @@ No Rotation:
deu: Keine Drehung
eng: No Rotation
fra: Pas de rotation
ita: Nessuna rotazione
ita: No rotazione
spa: No hay rotación
chs: 无旋转
jpn: 回転なし
Expand Down

0 comments on commit 2c1b17f

Please sign in to comment.