113 lines
3.6 KiB
NSIS
113 lines
3.6 KiB
NSIS
;--------------------------------
|
||
; Fichier : installer.nsi
|
||
;--------------------------------
|
||
|
||
!define MUI_ICON "kogusico.ico"
|
||
!define MUI_UNICON "kogusico.ico"
|
||
!define MUI_UNINST_ICON "kogusico.ico"
|
||
!define MUI_UNINSTALLER ; active l’uninstaller
|
||
!include "MUI2.nsh"
|
||
|
||
;--------------------------------
|
||
; Métadonnées produit
|
||
;--------------------------------
|
||
!define PRODUCT_NAME "Kogus"
|
||
!define PRODUCT_VERSION "1.0.0"
|
||
!define INSTALL_DIR "$PROGRAMFILES\\${PRODUCT_NAME}"
|
||
|
||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||
!define MUI_PRODUCT "${PRODUCT_NAME}"
|
||
|
||
; Pages de l’installateur
|
||
!insertmacro MUI_PAGE_WELCOME
|
||
!insertmacro MUI_PAGE_LICENSE "license.txt"
|
||
!insertmacro MUI_PAGE_DIRECTORY
|
||
!insertmacro MUI_PAGE_INSTFILES
|
||
!insertmacro MUI_PAGE_FINISH
|
||
|
||
; Pages de l’uninstaller
|
||
!insertmacro MUI_UNPAGE_CONFIRM
|
||
!insertmacro MUI_UNPAGE_INSTFILES
|
||
!insertmacro MUI_UNPAGE_FINISH
|
||
|
||
!insertmacro MUI_LANGUAGE "French"
|
||
|
||
OutFile "Kogus-${PRODUCT_VERSION}.exe"
|
||
InstallDir "${INSTALL_DIR}"
|
||
RequestExecutionLevel admin
|
||
ShowInstDetails show
|
||
|
||
;--------------------------------
|
||
; Section : Installation
|
||
;--------------------------------
|
||
Section "Install"
|
||
|
||
; 1. Créer le dossier d’installation et copier l’icône
|
||
SetOutPath "$INSTDIR"
|
||
File "kogusico.ico"
|
||
|
||
; 2. Copier docker-compose, config et script
|
||
File "docker-compose.yml"
|
||
File "sdk_relay.conf"
|
||
File "run.ps1"
|
||
|
||
; 3. Copier bitcoin
|
||
CreateDirectory "$INSTDIR\\bitcoin"
|
||
SetOutPath "$INSTDIR\\bitcoin"
|
||
File /r "bitcoin\\*.*"
|
||
|
||
; 4. Copier blindbit
|
||
CreateDirectory "$INSTDIR\\blindbit"
|
||
SetOutPath "$INSTDIR\\blindbit"
|
||
File /r "blindbit\\*.*"
|
||
|
||
; 5. Créer dossier de logs
|
||
CreateDirectory "$INSTDIR\\logs"
|
||
|
||
; 6. Raccourci Menu Démarrer pour lancer run.ps1
|
||
CreateDirectory "$SMPROGRAMS\\${PRODUCT_NAME}"
|
||
CreateShortCut "$SMPROGRAMS\\${PRODUCT_NAME}\\Lancer Kogus.lnk" \
|
||
"$INSTDIR\\run.ps1" "" \
|
||
"$INSTDIR\\kogusico.ico" 0
|
||
|
||
; 7. Lancement initial (install Docker si besoin)
|
||
ExecWait '"$SYSDIR\\WindowsPowerShell\\v1.0\\powershell.exe" -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File "$INSTDIR\\run.ps1" > "$INSTDIR\\logs\\install.log" 2>&1'
|
||
|
||
; 8. Auto-démarrage Docker Desktop au login utilisateur
|
||
WriteRegStr HKCU "Software\\Microsoft\\Windows\\CurrentVersion\\Run" \
|
||
"DockerDesktop" \
|
||
'"$PROGRAMFILES\\Docker\\Docker\\Docker Desktop.exe" --autostart'
|
||
|
||
; 9. Raccourci dans le dossier Démarrage pour relancer la stack Kogus
|
||
CreateDirectory "$SMSTARTUP"
|
||
CreateShortCut "$SMSTARTUP\\Relancer Kogus Stack.lnk" \
|
||
"$SYSDIR\\WindowsPowerShell\\v1.0\\powershell.exe" \
|
||
'-NoProfile -ExecutionPolicy Bypass -File "$INSTDIR\\run.ps1"' \
|
||
"$INSTDIR\\kogusico.ico" 0
|
||
|
||
; 10. Générer l’uninstaller
|
||
WriteUninstaller "$INSTDIR\\Uninstall.exe"
|
||
|
||
SectionEnd
|
||
|
||
;--------------------------------
|
||
; Section : Désinstallation
|
||
;--------------------------------
|
||
Section "Uninstall"
|
||
|
||
; Arrêter la stack Docker
|
||
nsExec::ExecToLog '"$SYSDIR\\WindowsPowerShell\\v1.0\\powershell.exe" -NoProfile -Command "docker compose -f `"$INSTDIR\\docker-compose.yml`" down"'
|
||
|
||
; Supprimer tous les fichiers et dossiers
|
||
RMDir /r "$INSTDIR"
|
||
|
||
; Supprimer le raccourci Menu Démarrer
|
||
Delete "$SMPROGRAMS\\${PRODUCT_NAME}\\Lancer Kogus.lnk"
|
||
RMDir "$SMPROGRAMS\\${PRODUCT_NAME}"
|
||
|
||
; Supprimer le raccourci de démarrage et l’entrée registre
|
||
Delete "$SMSTARTUP\\Relancer Kogus Stack.lnk"
|
||
DeleteRegValue HKCU "Software\\Microsoft\\Windows\\CurrentVersion\\Run" "DockerDesktop"
|
||
|
||
SectionEnd
|