FreeDATA/freedata-server-nsis-config.nsi

103 lines
2.6 KiB
Plaintext
Raw Normal View History

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