FreeDATA/freedata-server-nsis-config.nsi

103 lines
2.6 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
Name "FreeData Server"
2024-01-31 11:11:43 +00:00
OutFile "FreeData-Server-Installer.exe"
2024-01-30 20:41:25 +00:00
; Default installation directory
2024-02-04 12:44:03 +00:00
; InstallDir "$PROGRAMFILES\FreeData\freedata-server"
InstallDir "$LOCALAPPDATA\FreeData\freedata-server"
2024-01-30 20:41:25 +00:00
; Registry key to store the installation directory
2024-01-31 10:01:46 +00:00
InstallDirRegKey HKCU "Software\FreeData\freedata-server" "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
!define MUI_WELCOMEPAGE_TEXT "Welcome to the FreeData Server 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"
!define MUI_DIRECTORYPAGE_TEXT_TOP "Please select the installation folder. Its recommended using the suggested one for avoiding 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-04 12:44:03 +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-30 20:41:25 +00:00
2024-01-31 10:01:46 +00:00
; Set output path to the installation directory
2024-01-30 20:41:25 +00:00
SetOutPath $INSTDIR
2024-02-05 21:21:38 +00:00
; Check if "config.ini" exists and back it up
IfFileExists $INSTDIR\config.ini backupConfig
doneBackup:
2024-01-31 10:01:46 +00:00
; Add your application files here
2024-01-31 09:21:54 +00:00
File /r "modem\server.dist\*.*"
2024-01-30 20:41:25 +00:00
2024-02-05 21:21:38 +00:00
; Restore the original "config.ini" if it was backed up
IfFileExists $INSTDIR\config.ini.bak restoreConfig
2024-01-30 20:41:25 +00:00
2024-01-31 10:01:46 +00:00
; Create a shortcut in the user's desktop
2024-01-30 20:41:25 +00:00
CreateShortCut "$DESKTOP\FreeData Server.lnk" "$INSTDIR\freedata-server.exe"
2024-01-31 10:01:46 +00:00
; Create Uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
2024-02-05 21:21:38 +00: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 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-01-31 10:01:46 +00:00
; Delete files and directories
Delete $INSTDIR\freedata-server.exe
2024-01-30 20:41:25 +00:00
RMDir /r $INSTDIR
2024-01-31 10:01:46 +00:00
; Remove the shortcut
2024-01-30 20:41:25 +00:00
Delete "$DESKTOP\FreeData Server.lnk"
2024-01-31 10:01:46 +00:00
; Additional uninstallation commands here
SectionEnd