diff --git a/installer.nsi b/installer.nsi new file mode 100644 index 0000000..3480dc8 --- /dev/null +++ b/installer.nsi @@ -0,0 +1,80 @@ +;-------------------------------- +; Fichier : installer.nsi +;-------------------------------- + +!define MUI_ICON "kogusico.ico" +!define MUI_UNICON "kogusico.ico" +!define MUI_UNINST_ICON "kogusico.ico" + +!include "MUI2.nsh" +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "license.txt" +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH +!insertmacro MUI_LANGUAGE "French" + +;-------------------------------- +; Métadonnées produit +;-------------------------------- +!define PRODUCT_NAME "Kogus" +!define PRODUCT_VERSION "1.0.0" +!define INSTALL_DIR "$PROGRAMFILES\\${PRODUCT_NAME}" + +OutFile "Kogus-${PRODUCT_VERSION}.exe" +InstallDir "${INSTALL_DIR}" +RequestExecutionLevel admin +ShowInstDetails show + +;-------------------------------- +; Section : Installation +;-------------------------------- +Section "Install" + + ; 1. Répertoire racine + SetOutPath "$INSTDIR" + + ; 2. Copier docker-compose.yml, config et script + File "docker-compose.yml" + File "sdk_relay.conf" + File "run.ps1" + + ; 3. Copier le dossier bitcoin + CreateDirectory "$INSTDIR\\bitcoin" + SetOutPath "$INSTDIR\\bitcoin" + File /r "bitcoin\\*.*" + + ; 4. Copier le dossier blindbit + CreateDirectory "$INSTDIR\\blindbit" + SetOutPath "$INSTDIR\\blindbit" + File /r "blindbit\\*.*" + + ; 5. Créer dossier de logs + CreateDirectory "$INSTDIR\\logs" + + ; 6. Raccourci dans le menu Démarrer + CreateDirectory "$SMPROGRAMS\\${PRODUCT_NAME}" + CreateShortCut "$SMPROGRAMS\\${PRODUCT_NAME}\\Lancer Kogus.lnk" \ + "$INSTDIR\\run.ps1" "" "$INSTDIR\\run.ps1" 0 + + ; 7. Exécuter le script d’installation/stack et journaliser + ExecWait 'cmd /c ""$SYSDIR\\WindowsPowerShell\\v1.0\\powershell.exe" -NoProfile -ExecutionPolicy Bypass -File "$INSTDIR\\run.ps1" > "$INSTDIR\\logs\\install.log" 2>&1"' + +SectionEnd + +;-------------------------------- +; Section : Désinstallation +;-------------------------------- +Section "Uninstall" + + ; 1. Arrêter la stack Docker + nsExec::ExecToLog '"$SYSDIR\\WindowsPowerShell\\v1.0\\powershell.exe" -NoProfile -Command "docker compose -f `"$INSTDIR\\docker-compose.yml`" down"' + + ; 2. Supprimer les fichiers et dossiers + RMDir /r "$INSTDIR" + + ; 3. Supprimer le raccourci et le dossier Menu Démarrer + Delete "$SMPROGRAMS\\${PRODUCT_NAME}\\Lancer Kogus.lnk" + RMDir "$SMPROGRAMS\\${PRODUCT_NAME}" + +SectionEnd