FreeDATA/freedata-nsis-config.nsi

133 lines
3.9 KiB
Text
Raw Normal View History

2024-01-31 10:01:46 +00:00
!include "MUI2.nsh"
2024-01-30 20:41:25 +00:00
2024-02-03 19:27:55 +00:00
; Request administrative rights
RequestExecutionLevel admin
2024-01-31 10:01:46 +00:00
; The name and file name of the installer
2024-02-29 14:05:54 +00:00
Name "FreeDATA Installer"
OutFile "FreeDATA-Installer.exe"
2024-01-30 20:41:25 +00:00
2024-02-29 14:05:54 +00:00
; Default installation directory for the server
InstallDir "$LOCALAPPDATA\FreeDATA"
2024-01-30 20:41:25 +00:00
; Registry key to store the installation directory
2024-02-29 14:05:54 +00:00
InstallDirRegKey HKCU "Software\FreeDATA" "Install_Dir"
2024-01-30 20:41:25 +00:00
2024-01-31 10:01:46 +00:00
; Modern UI settings
!define MUI_ABORTWARNING
2024-01-30 20:41:25 +00:00
2024-02-03 19:44:49 +00:00
; Installer interface settings
!define MUI_ICON "documentation\icon.ico"
!define MUI_UNICON "documentation\icon.ico" ; Icon for the uninstaller
2024-01-31 10:01:46 +00:00
; Define the welcome page text
2024-02-29 14:05:54 +00:00
!define MUI_WELCOMEPAGE_TEXT "Welcome to the FreeDATA Setup Wizard. This wizard will guide you through the installation process."
2024-02-04 12:44:03 +00:00
!define MUI_FINISHPAGE_TEXT "Folder: $INSTDIR"
2024-02-29 14:05:54 +00:00
!define MUI_DIRECTORYPAGE_TEXT_TOP "Please select the installation folder. It's recommended to use the suggested one to avoid permission problems."
2024-01-30 20:41:25 +00:00
2024-01-31 10:01:46 +00:00
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE"
2024-02-29 14:05:54 +00:00
!insertmacro MUI_PAGE_COMPONENTS
2024-01-31 10:01:46 +00:00
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
2024-01-31 09:19:07 +00:00
2024-01-31 10:01:46 +00:00
; Uninstaller
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
2024-01-31 09:19:07 +00:00
2024-01-31 10:01:46 +00:00
; Language (you can choose and configure the language(s) you want)
!insertmacro MUI_LANGUAGE "English"
2024-01-31 09:19:07 +00:00
2024-01-31 10:01:46 +00:00
; Installer Sections
2024-02-03 19:44:49 +00:00
Section "FreeData Server" SEC01
2024-01-31 10:01:46 +00:00
; Set output path to the installation directory
2024-02-29 14:05:54 +00:00
SetOutPath $INSTDIR\freedata-server
2024-02-05 21:21:38 +00:00
; Check if "config.ini" exists and back it up
IfFileExists $INSTDIR\freedata-server\config.ini backupConfig
doneBackup:
2024-01-31 10:01:46 +00:00
; Add your application files here
2024-04-17 21:18:55 +00:00
File /r "freedata-server\server.dist\*"
2024-01-30 20:41:25 +00:00
; Restore the original "config.ini" if it was backed up
IfFileExists $INSTDIR\freedata-server\config.ini.bak restoreConfig
2024-01-31 10:01:46 +00:00
; Create a shortcut in the user's desktop
2024-03-03 08:53:55 +00:00
CreateShortCut "$DESKTOP\FreeDATA Server.lnk" "$INSTDIR\freedata-server\freedata-server.exe"
2024-01-30 20:41:25 +00:00
2024-01-31 10:01:46 +00:00
; Create Uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
; Create a Start Menu directory
CreateDirectory "$SMPROGRAMS\FreeDATA"
; Create shortcut in the Start Menu directory
CreateShortCut "$SMPROGRAMS\FreeDATA\FreeDATA Server.lnk" "$INSTDIR\freedata-server\freedata-server.exe"
; Create an Uninstall shortcut
CreateShortCut "$SMPROGRAMS\FreeDATA\Uninstall FreeDATA.lnk" "$INSTDIR\Uninstall.exe"
; Backup "config.ini" before overwriting files
backupConfig:
Rename $INSTDIR\freedata-server\config.ini $INSTDIR\freedata-server\config.ini.bak
Goto doneBackup
; Restore the original "config.ini"
restoreConfig:
Delete $INSTDIR\freedata-server\config.ini
Rename $INSTDIR\freedata-server\config.ini.bak $INSTDIR\freedata-server\config.ini
2024-02-29 14:05:54 +00:00
SectionEnd
2024-02-05 21:21:38 +00:00
2024-02-29 14:27:39 +00:00
Section "FreeData x64 GUI" SEC02
2024-02-29 14:05:54 +00:00
; Set output path to the GUI installation directory
SetOutPath $INSTDIR\freedata-gui
2024-02-05 21:21:38 +00:00
2024-02-29 14:05:54 +00:00
; Add GUI files here
2024-04-17 21:18:55 +00:00
File /r "freedata-gui\release\win-unpacked\*"
2024-02-05 21:21:38 +00:00
2024-02-29 14:05:54 +00:00
; Create a shortcut on the desktop for the GUI
CreateShortCut "$DESKTOP\FreeDATA GUI.lnk" "$INSTDIR\freedata-gui\freedata.exe"
; Create a start menu shortcut
CreateShortCut "$SMPROGRAMS\FreeDATA\FreeDATA GUI.lnk" "$INSTDIR\freedata-gui\freedata.exe"
; Create an Uninstall shortcut
CreateShortCut "$SMPROGRAMS\FreeDATA\Uninstall FreeDATA.lnk" "$INSTDIR\Uninstall.exe"
2024-01-30 20:41:25 +00:00
SectionEnd
2024-01-31 10:01:46 +00:00
; Uninstaller Section
2024-01-30 20:41:25 +00:00
Section "Uninstall"
2024-02-29 14:05:54 +00:00
; Delete files and directories for the server
2024-03-03 08:53:55 +00:00
Delete $INSTDIR\freedata-server\*.*
2024-02-29 14:05:54 +00:00
RMDir /r $INSTDIR\freedata-server
2024-01-30 20:41:25 +00:00
2024-02-29 14:05:54 +00:00
; Delete files and directories for the GUI
Delete $INSTDIR\freedata-gui\*.*
RMDir /r $INSTDIR\freedata-gui
2024-01-30 20:41:25 +00:00
2024-02-29 14:05:54 +00:00
; Remove the desktop shortcuts
Delete "$DESKTOP\FreeDATA Server.lnk"
Delete "$DESKTOP\FreeDATA GUI.lnk"
2024-01-31 10:01:46 +00:00
; Remove Start Menu shortcuts
Delete "$SMPROGRAMS\FreeDATA\*.*"
RMDir "$SMPROGRAMS\FreeDATA"
; Attempt to delete the uninstaller itself
Delete $EXEPATH
; Now remove the installation directory if it's empty
RMDir /r $INSTDIR
2024-01-31 10:01:46 +00:00
SectionEnd