taler-windows

Windows packaging
Log | Files | Refs

taler-installer-taler.nsi (40498B)


      1 ; This file is part of GNU Taler.
      2 ; Copyright (C) 2025 Taler Systems SA
      3 ;
      4 ; Author: Léa Oualli
      5 
      6 Unicode true
      7 
      8 !include "MUI2.nsh"
      9 !include "LogicLib.nsh"
     10 !include "FileFunc.nsh"
     11 !include "WinMessages.nsh"
     12 !include "nsDialogs.nsh"
     13 
     14 !define MUI_ABORTWARNING
     15 ; MUI owns .onUserAbort (that is how MUI_ABORTWARNING works), so the
     16 ; cancellation is logged through MUI's own hook instead of a second one.
     17 !define MUI_CUSTOMFUNCTION_ABORT "TalerOnAbort"
     18 !define MUI_LANGDLL_DISPLAY
     19 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
     20 !define MUI_LANGDLL_REGISTRY_KEY "Software\TalerInstaller"
     21 !define MUI_LANGDLL_REGISTRY_VALUENAME "InstallerLanguage"
     22 
     23 Name "Taler-Merchant backend"
     24 Outfile "taler-installer.exe"
     25 InstallDir "$PROGRAMFILES\TalerMerchant"
     26 RequestExecutionLevel admin
     27 
     28 Icon "logo-header.ico"
     29 !define MUI_ICON "logo-header.ico"
     30 !define MUI_HEADERIMAGE
     31 !define MUI_HEADERIMAGE_RIGHT
     32 !define MUI_HEADERIMAGE_BITMAP "logo-header.bmp"
     33 !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
     34 !define MUI_WELCOMEFINISHPAGE_BITMAP "logo-welcome.bmp"
     35 
     36 ; MSG_WELCOME_TITLE / MSG_WELCOME_TEXT were translated but never
     37 ; referenced, so the welcome page showed the generic MUI text in every
     38 ; language.  $_CLICK is supplied by the MUI language files.
     39 !define MUI_WELCOMEPAGE_TITLE "$(MSG_WELCOME_TITLE)"
     40 !define MUI_WELCOMEPAGE_TEXT "$(MSG_WELCOME_TEXT)$\r$\n$\r$\n$_CLICK"
     41 !insertmacro MUI_PAGE_WELCOME
     42 !insertmacro MUI_PAGE_DIRECTORY
     43 Page custom DistroPage DistroPageLeave
     44 Page custom DomainPage DomainPageLeave
     45 Page custom ReverseProxyPage ReverseProxyPageLeave
     46 !insertmacro MUI_PAGE_INSTFILES
     47 Page custom AskExternalDBPage AskExternalDBPageLeave
     48 Page custom DBUrlPage DBUrlPageLeave
     49 !insertmacro MUI_PAGE_FINISH
     50 
     51 !insertmacro MUI_LANGUAGE "English"
     52 !insertmacro MUI_LANGUAGE "French"
     53 !insertmacro MUI_LANGUAGE "German"
     54 !insertmacro MUI_LANGUAGE "Italian"
     55 !insertmacro MUI_LANGUAGE "Spanish"
     56 !insertmacro MUI_LANGUAGE "Dutch"
     57 
     58 Var /GLOBAL HWND_PROGRESS_LABEL
     59 Var /GLOBAL DOMAIN_INPUT
     60 Var /GLOBAL DOMAIN_VALUE
     61 Var /GLOBAL WSL_DISTRO
     62 Var /GLOBAL RADIO_DEBIAN
     63 Var /GLOBAL RADIO_UBUNTU
     64 Var /GLOBAL REVERSE_PROXY_MODE
     65 Var /GLOBAL RADIO_HTTP_ONLY
     66 Var /GLOBAL RADIO_HTTPS
     67 Var /GLOBAL WSL_SCRIPT_DIR
     68 Var /GLOBAL DB_URL
     69 Var /GLOBAL DBCONFIG_INPUT
     70 Var /GLOBAL ASK_DB_YESNO
     71 Var /GLOBAL USE_EXTERNAL_DB
     72 Var /GLOBAL INSTALL_OK
     73 
     74 LangString MSG_WELCOME_TITLE ${LANG_ENGLISH} "GNU Taler-Merchant backend for Windows"
     75 LangString MSG_WELCOME_TITLE ${LANG_FRENCH} "Backend GNU Taler-Merchant pour Windows"
     76 LangString MSG_WELCOME_TITLE ${LANG_GERMAN} "GNU Taler-Merchant-Backend für Windows"
     77 LangString MSG_WELCOME_TITLE ${LANG_ITALIAN} "Backend GNU Taler-Merchant per Windows"
     78 LangString MSG_WELCOME_TITLE ${LANG_SPANISH} "Backend de GNU Taler-Merchant para Windows"
     79 LangString MSG_WELCOME_TITLE ${LANG_DUTCH} "GNU Taler-Merchant-backend voor Windows"
     80 
     81 LangString MSG_WELCOME_TEXT ${LANG_ENGLISH} "This wizard will install The GNU Taler-Merchant using WSL and Debian or Ubuntu."
     82 LangString MSG_WELCOME_TEXT ${LANG_FRENCH} "Cet assistant va installer le backend GNU Taler-Merchant avec WSL et Debian ou Ubuntu."
     83 LangString MSG_WELCOME_TEXT ${LANG_GERMAN} "Dieser Assistent installiert das GNU Taler-Merchant-Backend mit WSL und Debian oder Ubuntu."
     84 LangString MSG_WELCOME_TEXT ${LANG_ITALIAN} "Questa procedura guidata installerà il backend GNU Taler-Merchant tramite WSL e Debian o Ubuntu."
     85 LangString MSG_WELCOME_TEXT ${LANG_SPANISH} "Este asistente instalará el backend de GNU Taler-Merchant mediante WSL y Debian o Ubuntu."
     86 LangString MSG_WELCOME_TEXT ${LANG_DUTCH} "Deze wizard installeert de GNU Taler-Merchant-backend met WSL en Debian of Ubuntu."
     87 
     88 LangString ENTER_DOMAIN ${LANG_ENGLISH} "Enter your Taler-Merchant domain name:"
     89 LangString ENTER_DOMAIN ${LANG_FRENCH} "Entrez le nom de domaine de votre backend Taler-Merchant :"
     90 LangString ENTER_DOMAIN ${LANG_GERMAN} "Geben Sie den Domainnamen Ihres Taler-Merchant-Backends ein:"
     91 LangString ENTER_DOMAIN ${LANG_ITALIAN} "Inserire il nome di dominio del backend Taler-Merchant:"
     92 LangString ENTER_DOMAIN ${LANG_SPANISH} "Introduzca el nombre de dominio de su backend Taler-Merchant:"
     93 LangString ENTER_DOMAIN ${LANG_DUTCH} "Voer de domeinnaam van uw Taler-Merchant-backend in:"
     94 
     95 LangString MSG_DOMAIN_REQUIRED ${LANG_ENGLISH} "Please enter a domain name."
     96 LangString MSG_DOMAIN_REQUIRED ${LANG_FRENCH} "Veuillez saisir un nom de domaine."
     97 LangString MSG_DOMAIN_REQUIRED ${LANG_GERMAN} "Bitte geben Sie einen Domainnamen ein."
     98 LangString MSG_DOMAIN_REQUIRED ${LANG_ITALIAN} "Inserire un nome di dominio."
     99 LangString MSG_DOMAIN_REQUIRED ${LANG_SPANISH} "Introduzca un nombre de dominio."
    100 LangString MSG_DOMAIN_REQUIRED ${LANG_DUTCH} "Voer een domeinnaam in."
    101 
    102 LangString MSG_LOCALHOST_WARN ${LANG_ENGLISH} "Warning: using 'localhost' means your merchant will not be publicly accessible."
    103 LangString MSG_LOCALHOST_WARN ${LANG_FRENCH} "Attention : utiliser 'localhost' signifie que votre commerçant ne sera pas accessible publiquement."
    104 LangString MSG_LOCALHOST_WARN ${LANG_GERMAN} "Warnung: Mit 'localhost' ist Ihr Händler nicht öffentlich erreichbar."
    105 LangString MSG_LOCALHOST_WARN ${LANG_ITALIAN} "Attenzione: usando 'localhost' il venditore non sarà raggiungibile pubblicamente."
    106 LangString MSG_LOCALHOST_WARN ${LANG_SPANISH} "Advertencia: al usar 'localhost', su comerciante no será accesible públicamente."
    107 LangString MSG_LOCALHOST_WARN ${LANG_DUTCH} "Waarschuwing: met 'localhost' is uw verkoper niet openbaar toegankelijk."
    108 
    109 LangString MSG_STEP1 ${LANG_ENGLISH} "Step 1: Enabling WSL and VirtualMachinePlatform.$\r$\n$\r$\nThis is the slowest step and can take several minutes (up to 10 minutes on some computers).$\r$\n$\r$\nPlease DO NOT close the installer. You will see the progress bar freeze during this step.$\r$\n$\r$\nThe installation will continue automatically once this step is done."
    110 LangString MSG_STEP1 ${LANG_FRENCH} "Étape 1 : activation de WSL et VirtualMachinePlatform.$\r$\n$\r$\nC'est l'étape la plus lente et elle peut prendre plusieurs minutes (jusqu'à 10 minutes sur certains ordinateurs).$\r$\n$\r$\nVeuillez NE PAS fermer l'installateur. La barre de progression peut sembler bloquée pendant cette étape.$\r$\n$\r$\nL'installation continuera automatiquement dès que cette étape sera terminée."
    111 LangString MSG_STEP1 ${LANG_GERMAN} "Schritt 1: WSL und VirtualMachinePlatform werden aktiviert.$\r$\n$\r$\nDies ist der langsamste Schritt und kann mehrere Minuten dauern (auf manchen Rechnern bis zu 10 Minuten).$\r$\n$\r$\nSchließen Sie das Installationsprogramm NICHT. Der Fortschrittsbalken bleibt in diesem Schritt scheinbar stehen.$\r$\n$\r$\nDie Installation wird automatisch fortgesetzt, sobald dieser Schritt abgeschlossen ist."
    112 LangString MSG_STEP1 ${LANG_ITALIAN} "Passo 1: attivazione di WSL e VirtualMachinePlatform.$\r$\n$\r$\nQuesto è il passo più lento e può richiedere diversi minuti (fino a 10 minuti su alcuni computer).$\r$\n$\r$\nNON chiudere il programma di installazione. In questa fase la barra di avanzamento sembrerà bloccata.$\r$\n$\r$\nL'installazione continuerà automaticamente al termine di questo passo."
    113 LangString MSG_STEP1 ${LANG_SPANISH} "Paso 1: activación de WSL y VirtualMachinePlatform.$\r$\n$\r$\nEste es el paso más lento y puede tardar varios minutos (hasta 10 minutos en algunos equipos).$\r$\n$\r$\nNO cierre el instalador. Durante este paso la barra de progreso parecerá detenida.$\r$\n$\r$\nLa instalación continuará automáticamente cuando el paso haya terminado."
    114 LangString MSG_STEP1 ${LANG_DUTCH} "Stap 1: WSL en VirtualMachinePlatform worden geactiveerd.$\r$\n$\r$\nDit is de langzaamste stap en kan enkele minuten duren (op sommige computers tot 10 minuten).$\r$\n$\r$\nSluit het installatieprogramma NIET. De voortgangsbalk lijkt tijdens deze stap stil te staan.$\r$\n$\r$\nDe installatie gaat automatisch verder zodra deze stap klaar is."
    115 
    116 LangString MSG_NEED_REBOOT ${LANG_ENGLISH} "WSL features have just been enabled. You must restart your computer NOW to continue the installation. Please run this installer again after reboot."
    117 LangString MSG_NEED_REBOOT ${LANG_FRENCH} "Les fonctionnalités WSL viennent d'être activées. Vous devez redémarrer votre ordinateur MAINTENANT pour poursuivre l'installation. Relancez cet installateur après le redémarrage."
    118 LangString MSG_NEED_REBOOT ${LANG_GERMAN} "Die WSL-Funktionen wurden gerade aktiviert. Sie müssen Ihren Computer JETZT neu starten, um die Installation fortzusetzen. Starten Sie dieses Installationsprogramm nach dem Neustart erneut."
    119 LangString MSG_NEED_REBOOT ${LANG_ITALIAN} "Le funzionalità WSL sono state appena attivate. È necessario riavviare il computer ORA per continuare l'installazione. Eseguire di nuovo questo programma di installazione dopo il riavvio."
    120 LangString MSG_NEED_REBOOT ${LANG_SPANISH} "Las funciones de WSL se acaban de activar. Debe reiniciar el equipo AHORA para continuar la instalación. Vuelva a ejecutar este instalador después del reinicio."
    121 LangString MSG_NEED_REBOOT ${LANG_DUTCH} "De WSL-functies zijn net geactiveerd. U moet uw computer NU opnieuw opstarten om de installatie voort te zetten. Start dit installatieprogramma na het opnieuw opstarten nogmaals."
    122 
    123 LangString MSG_UPDATE_WSL ${LANG_ENGLISH} "A Windows update window will now appear to update WSL. Please follow the instructions in the black window and press any key if prompted. Click OK to continue."
    124 LangString MSG_UPDATE_WSL ${LANG_FRENCH} "Une fenêtre Windows va apparaître pour mettre à jour WSL. Suivez les instructions affichées dans la fenêtre noire et appuyez sur une touche si cela vous est demandé. Cliquez sur OK pour continuer."
    125 LangString MSG_UPDATE_WSL ${LANG_GERMAN} "Es erscheint nun ein Windows-Fenster, um WSL zu aktualisieren. Folgen Sie den Anweisungen im schwarzen Fenster und drücken Sie eine beliebige Taste, wenn Sie dazu aufgefordert werden. Klicken Sie auf OK, um fortzufahren."
    126 LangString MSG_UPDATE_WSL ${LANG_ITALIAN} "Verrà ora visualizzata una finestra di Windows per aggiornare WSL. Seguire le istruzioni nella finestra nera e premere un tasto qualsiasi se richiesto. Fare clic su OK per continuare."
    127 LangString MSG_UPDATE_WSL ${LANG_SPANISH} "Ahora aparecerá una ventana de Windows para actualizar WSL. Siga las instrucciones de la ventana negra y pulse cualquier tecla si se le solicita. Haga clic en OK para continuar."
    128 LangString MSG_UPDATE_WSL ${LANG_DUTCH} "Er verschijnt nu een Windows-venster om WSL bij te werken. Volg de instructies in het zwarte venster en druk op een willekeurige toets als daarom wordt gevraagd. Klik op OK om verder te gaan."
    129 
    130 LangString MSG_INSTALL_FAILED ${LANG_ENGLISH} "Installation failed. Opening install.log..."
    131 LangString MSG_INSTALL_FAILED ${LANG_FRENCH} "L'installation a échoué. Ouverture du fichier install.log..."
    132 LangString MSG_INSTALL_FAILED ${LANG_GERMAN} "Die Installation ist fehlgeschlagen. install.log wird geöffnet..."
    133 LangString MSG_INSTALL_FAILED ${LANG_ITALIAN} "Installazione non riuscita. Apertura di install.log..."
    134 LangString MSG_INSTALL_FAILED ${LANG_SPANISH} "La instalación ha fallado. Abriendo install.log..."
    135 LangString MSG_INSTALL_FAILED ${LANG_DUTCH} "De installatie is mislukt. install.log wordt geopend..."
    136 
    137 LangString MSG_REVERSE_PROXY_TITLE ${LANG_ENGLISH} "Select reverse proxy mode:"
    138 LangString MSG_REVERSE_PROXY_TITLE ${LANG_FRENCH} "Choisissez le mode du reverse proxy :"
    139 LangString MSG_REVERSE_PROXY_TITLE ${LANG_GERMAN} "Wählen Sie den Reverse-Proxy-Modus:"
    140 LangString MSG_REVERSE_PROXY_TITLE ${LANG_ITALIAN} "Selezionare la modalità del reverse proxy:"
    141 LangString MSG_REVERSE_PROXY_TITLE ${LANG_SPANISH} "Seleccione el modo del proxy inverso:"
    142 LangString MSG_REVERSE_PROXY_TITLE ${LANG_DUTCH} "Selecteer de modus van de reverse proxy:"
    143 
    144 LangString MSG_HTTP_ONLY ${LANG_ENGLISH} "HTTP only"
    145 LangString MSG_HTTP_ONLY ${LANG_FRENCH} "HTTP uniquement"
    146 LangString MSG_HTTP_ONLY ${LANG_GERMAN} "Nur HTTP"
    147 LangString MSG_HTTP_ONLY ${LANG_ITALIAN} "Solo HTTP"
    148 LangString MSG_HTTP_ONLY ${LANG_SPANISH} "Solo HTTP"
    149 LangString MSG_HTTP_ONLY ${LANG_DUTCH} "Alleen HTTP"
    150 
    151 LangString MSG_HTTPS ${LANG_ENGLISH} "HTTPS"
    152 LangString MSG_HTTPS ${LANG_FRENCH} "HTTPS"
    153 LangString MSG_HTTPS ${LANG_GERMAN} "HTTPS"
    154 LangString MSG_HTTPS ${LANG_ITALIAN} "HTTPS"
    155 LangString MSG_HTTPS ${LANG_SPANISH} "HTTPS"
    156 LangString MSG_HTTPS ${LANG_DUTCH} "HTTPS"
    157 
    158 LangString MSG_DOMAIN_PING_FAIL ${LANG_ENGLISH} "The domain '$0' did not respond to ping.$\r$\n$\r$\nClick Retry to try this domain again, or Cancel to use 'localhost'. To change domain, click Previous."
    159 LangString MSG_DOMAIN_PING_FAIL ${LANG_FRENCH} "Le domaine '$0' ne répond pas au ping.$\r$\n$\r$\nCliquez sur Réessayer pour retenter ce domaine, ou sur Annuler pour utiliser 'localhost'. Pour changer de domaine, cliquez sur Précédent."
    160 LangString MSG_DOMAIN_PING_FAIL ${LANG_GERMAN} "Die Domain '$0' hat nicht auf den Ping geantwortet.$\r$\n$\r$\nKlicken Sie auf Wiederholen, um es mit dieser Domain erneut zu versuchen, oder auf Abbrechen, um 'localhost' zu verwenden. Klicken Sie auf Zurück, um die Domain zu ändern."
    161 LangString MSG_DOMAIN_PING_FAIL ${LANG_ITALIAN} "Il dominio '$0' non ha risposto al ping.$\r$\n$\r$\nFare clic su Riprova per riprovare con questo dominio oppure su Annulla per usare 'localhost'. Per cambiare dominio, fare clic su Indietro."
    162 LangString MSG_DOMAIN_PING_FAIL ${LANG_SPANISH} "El dominio '$0' no ha respondido al ping.$\r$\n$\r$\nHaga clic en Reintentar para volver a probar este dominio o en Cancelar para usar 'localhost'. Para cambiar de dominio, haga clic en Atrás."
    163 LangString MSG_DOMAIN_PING_FAIL ${LANG_DUTCH} "Het domein '$0' heeft niet op de ping geantwoord.$\r$\n$\r$\nKlik op Opnieuw om dit domein nogmaals te proberen, of op Annuleren om 'localhost' te gebruiken. Klik op Vorige om een ander domein op te geven."
    164 
    165 LangString CHOOSE_DISTRO_LABEL ${LANG_ENGLISH} "Choose the WSL Linux distribution to install:"
    166 LangString CHOOSE_DISTRO_LABEL ${LANG_FRENCH} "Choisissez la distribution Linux WSL à installer :"
    167 LangString CHOOSE_DISTRO_LABEL ${LANG_GERMAN} "Wählen Sie die zu installierende WSL-Linux-Distribution:"
    168 LangString CHOOSE_DISTRO_LABEL ${LANG_ITALIAN} "Scegliere la distribuzione Linux WSL da installare:"
    169 LangString CHOOSE_DISTRO_LABEL ${LANG_SPANISH} "Elija la distribución de Linux para WSL que desea instalar:"
    170 LangString CHOOSE_DISTRO_LABEL ${LANG_DUTCH} "Kies de WSL-Linux-distributie die moet worden geïnstalleerd:"
    171 
    172 LangString ASK_DB_LABEL ${LANG_ENGLISH} "Installation finished. Do you want to use an external PostgreSQL database?"
    173 LangString ASK_DB_LABEL ${LANG_FRENCH} "Installation terminée. Voulez-vous utiliser une base de données PostgreSQL externe ?"
    174 LangString ASK_DB_LABEL ${LANG_GERMAN} "Die Installation ist abgeschlossen. Möchten Sie eine externe PostgreSQL-Datenbank verwenden?"
    175 LangString ASK_DB_LABEL ${LANG_ITALIAN} "Installazione completata. Utilizzare un database PostgreSQL esterno?"
    176 LangString ASK_DB_LABEL ${LANG_SPANISH} "Instalación finalizada. ¿Desea utilizar una base de datos PostgreSQL externa?"
    177 LangString ASK_DB_LABEL ${LANG_DUTCH} "De installatie is voltooid. Wilt u een externe PostgreSQL-database gebruiken?"
    178 
    179 LangString ASK_DB_YES ${LANG_ENGLISH} "Yes, configure an external database"
    180 LangString ASK_DB_YES ${LANG_FRENCH} "Oui, configurer une base de données externe"
    181 LangString ASK_DB_YES ${LANG_GERMAN} "Ja, eine externe Datenbank einrichten"
    182 LangString ASK_DB_YES ${LANG_ITALIAN} "Sì, configurare un database esterno"
    183 LangString ASK_DB_YES ${LANG_SPANISH} "Sí, configurar una base de datos externa"
    184 LangString ASK_DB_YES ${LANG_DUTCH} "Ja, een externe database instellen"
    185 
    186 LangString ASK_DB_NO ${LANG_ENGLISH} "No, use local database (default)"
    187 LangString ASK_DB_NO ${LANG_FRENCH} "Non, utiliser la base de données locale (par défaut)"
    188 LangString ASK_DB_NO ${LANG_GERMAN} "Nein, die lokale Datenbank verwenden (Standard)"
    189 LangString ASK_DB_NO ${LANG_ITALIAN} "No, usare il database locale (predefinito)"
    190 LangString ASK_DB_NO ${LANG_SPANISH} "No, usar la base de datos local (predeterminado)"
    191 LangString ASK_DB_NO ${LANG_DUTCH} "Nee, de lokale database gebruiken (standaard)"
    192 
    193 LangString ENTER_DB_URL_LABEL ${LANG_ENGLISH} "Enter the external PostgreSQL URL (e.g.: postgresql://user:pass@host:5432/dbname):"
    194 LangString ENTER_DB_URL_LABEL ${LANG_FRENCH} "Entrez l'URL PostgreSQL externe (par exemple postgresql://user:pass@host:5432/dbname) :"
    195 LangString ENTER_DB_URL_LABEL ${LANG_GERMAN} "Geben Sie die URL der externen PostgreSQL-Datenbank ein (z. B. postgresql://user:pass@host:5432/dbname):"
    196 LangString ENTER_DB_URL_LABEL ${LANG_ITALIAN} "Inserire l'URL PostgreSQL esterno (ad es. postgresql://user:pass@host:5432/dbname):"
    197 LangString ENTER_DB_URL_LABEL ${LANG_SPANISH} "Introduzca la URL de PostgreSQL externa (p. ej. postgresql://user:pass@host:5432/dbname):"
    198 LangString ENTER_DB_URL_LABEL ${LANG_DUTCH} "Voer de externe PostgreSQL-URL in (bijv. postgresql://user:pass@host:5432/dbname):"
    199 
    200 LangString DB_URL_REQUIRED ${LANG_ENGLISH} "You must enter a valid URL."
    201 LangString DB_URL_REQUIRED ${LANG_FRENCH} "Vous devez entrer une URL valide."
    202 LangString DB_URL_REQUIRED ${LANG_GERMAN} "Sie müssen eine gültige URL eingeben."
    203 LangString DB_URL_REQUIRED ${LANG_ITALIAN} "È necessario inserire un URL valido."
    204 LangString DB_URL_REQUIRED ${LANG_SPANISH} "Debe introducir una URL válida."
    205 LangString DB_URL_REQUIRED ${LANG_DUTCH} "U moet een geldige URL invoeren."
    206 
    207 LangString DB_CONN_OK ${LANG_ENGLISH} "External database configured successfully!"
    208 LangString DB_CONN_OK ${LANG_FRENCH} "Base de données externe configurée avec succès !"
    209 LangString DB_CONN_OK ${LANG_GERMAN} "Die externe Datenbank wurde erfolgreich eingerichtet!"
    210 LangString DB_CONN_OK ${LANG_ITALIAN} "Database esterno configurato correttamente!"
    211 LangString DB_CONN_OK ${LANG_SPANISH} "¡La base de datos externa se ha configurado correctamente!"
    212 LangString DB_CONN_OK ${LANG_DUTCH} "De externe database is ingesteld!"
    213 
    214 LangString DB_CONN_FAIL ${LANG_ENGLISH} "Connection to the database failed. Retry/modify URL or Cancel to use local."
    215 LangString DB_CONN_FAIL ${LANG_FRENCH} "La connexion à la base de données a échoué. Cliquez sur Réessayer pour corriger l'URL, ou sur Annuler pour rester en local."
    216 LangString DB_CONN_FAIL ${LANG_GERMAN} "Die Verbindung zur Datenbank ist fehlgeschlagen. Wiederholen bzw. URL ändern, oder Abbrechen, um die lokale Datenbank zu verwenden."
    217 LangString DB_CONN_FAIL ${LANG_ITALIAN} "Connessione al database non riuscita. Riprovare o modificare l'URL, oppure Annulla per usare il database locale."
    218 LangString DB_CONN_FAIL ${LANG_SPANISH} "La conexión con la base de datos ha fallado. Reintente o modifique la URL, o pulse Cancelar para usar la base local."
    219 LangString DB_CONN_FAIL ${LANG_DUTCH} "De verbinding met de database is mislukt. Probeer het opnieuw of pas de URL aan, of klik op Annuleren om de lokale database te gebruiken."
    220 
    221 LangString MSG_DONE_OPEN_BROWSER ${LANG_ENGLISH} "Installation is complete! Your browser will now open your domain."
    222 LangString MSG_DONE_OPEN_BROWSER ${LANG_FRENCH} "L'installation est terminée ! Votre navigateur va maintenant ouvrir votre domaine."
    223 LangString MSG_DONE_OPEN_BROWSER ${LANG_GERMAN} "Die Installation ist abgeschlossen! Ihr Browser öffnet nun Ihre Domain."
    224 LangString MSG_DONE_OPEN_BROWSER ${LANG_ITALIAN} "Installazione completata! Il browser aprirà ora il dominio configurato."
    225 LangString MSG_DONE_OPEN_BROWSER ${LANG_SPANISH} "¡La instalación ha finalizado! Su navegador abrirá ahora su dominio."
    226 LangString MSG_DONE_OPEN_BROWSER ${LANG_DUTCH} "De installatie is voltooid! Uw browser opent nu uw domein."
    227 
    228 ; ------------------------------------------------------------------ install.log
    229 ; readme.txt, MSG_INSTALL_FAILED and .onInstFailed have always pointed the
    230 ; operator at C:\Users\Public\install.log, but nothing ever wrote it: a failed
    231 ; install popped up an error box naming a file that did not exist.  This is
    232 ; that file.  It records the Windows side of the run -- what the wizard was
    233 ; told, what each step returned, and where the other logs are -- because
    234 ; everything the batch and bash scripts log is itself unreachable when WSL is
    235 ; what failed to come up.
    236 ;
    237 ; The path is hard-coded the way readme.txt advertises it, next to the
    238 ; taler-bat.log that setup-wsl-debian.bat hard-codes for itself.
    239 ; C:\Users\Public is readable by every account on the machine, so NOTHING
    240 ; secret may be written here -- see RedactDbUrl.
    241 !define TALER_LOGFILE "C:\Users\Public\install.log"
    242 
    243 ; Appends one timestamped line.  Opening and closing the file per line is
    244 ; deliberate: this installer can sit for ten minutes inside a single nsExec
    245 ; call and be killed there, and the lines written before that have to already
    246 ; be on disk.  A log that cannot be opened is never fatal -- an unwritable log
    247 ; must not stop an install that would otherwise work.
    248 Function TalerLog
    249     Exch $R0
    250     Push $R1
    251     Push $R2
    252     Push $R3
    253     Push $R4
    254     Push $R5
    255     Push $R6
    256     Push $R7
    257     Push $R8
    258     ${GetTime} "" "L" $R2 $R3 $R4 $R5 $R6 $R7 $R8
    259     ; The error flag is cumulative and no successful instruction resets it
    260     ; (exec.c: g_exec_flags.exec_error += exec_error), so it has to be cleared
    261     ; here and not before GetTime -- otherwise a GetTime that failed would
    262     ; silently discard every later line even though the file opened fine.
    263     ClearErrors
    264     FileOpen $R1 "${TALER_LOGFILE}" a
    265     ; Mode "a" is OPEN_ALWAYS and leaves the pointer at 0, hence the seek.
    266     ${IfNot} ${Errors}
    267         FileSeek $R1 0 END
    268         FileWrite $R1 "$R4-$R3-$R2 $R6:$R7:$R8  $R0$\r$\n"
    269         FileClose $R1
    270     ${EndIf}
    271     ClearErrors
    272     Pop $R8
    273     Pop $R7
    274     Pop $R6
    275     Pop $R5
    276     Pop $R4
    277     Pop $R3
    278     Pop $R2
    279     Pop $R1
    280     Pop $R0
    281 FunctionEnd
    282 
    283 ; ${TLog} goes to install.log only; ${TSay} also shows the line in the details
    284 ; view, for the events an operator should watch happening.
    285 !macro TALER_LOG TEXT
    286     Push "${TEXT}"
    287     Call TalerLog
    288 !macroend
    289 !define TLog "!insertmacro TALER_LOG"
    290 
    291 !macro TALER_SAY TEXT
    292     DetailPrint "${TEXT}"
    293     Push "${TEXT}"
    294     Call TalerLog
    295 !macroend
    296 !define TSay "!insertmacro TALER_SAY"
    297 
    298 ; The external database URL carries a password, and install.log is world
    299 ; readable, so neither the log nor the details view may ever see it whole.
    300 ; Everything up to and including the last '@' is dropped; a PostgreSQL URI
    301 ; cannot carry an unescaped '@' in its credentials, so what survives is the
    302 ; host and database name -- which is the part worth having when a connection
    303 ; fails.  An URL with no credentials at all is passed through unchanged.
    304 Function RedactDbUrl
    305     Exch $R0
    306     Push $R1
    307     Push $R2
    308     Push $R3
    309     StrCpy $R1 0
    310     StrCpy $R3 ""
    311   rdu_scan:
    312     StrCpy $R2 $R0 1 $R1
    313     StrCmp $R2 "" rdu_scanned
    314     StrCmp $R2 "@" 0 rdu_next
    315         StrCpy $R3 $R1
    316   rdu_next:
    317     IntOp $R1 $R1 + 1
    318     Goto rdu_scan
    319   rdu_scanned:
    320     StrCmp $R3 "" rdu_out
    321         IntOp $R3 $R3 + 1
    322         StrCpy $R0 $R0 "" $R3
    323         StrCpy $R0 "(credentials hidden)@$R0"
    324   rdu_out:
    325     Pop $R3
    326     Pop $R2
    327     Pop $R1
    328     Exch $R0
    329 FunctionEnd
    330 
    331 ; Truncates install.log and records what is known before anything is
    332 ; attempted: the machine, the installer and the chosen language.  One file per
    333 ; run, so the log always describes the run being reported.
    334 Function TalerLogStart
    335     ClearErrors
    336     FileOpen $R0 "${TALER_LOGFILE}" w
    337     ${IfNot} ${Errors}
    338         FileClose $R0
    339     ${EndIf}
    340     ClearErrors
    341 
    342     ${TLog} "=== GNU Taler-Merchant backend installer ==="
    343     ${TLog} "installer   : $EXEPATH"
    344     ${TLog} "target dir  : $INSTDIR"
    345     ${TLog} "language    : LCID $LANGUAGE"
    346 
    347     ; A 32-bit installer is handed the redirected registry, so ask for the
    348     ; real 64-bit view and put it back afterwards.
    349     SetRegView 64
    350     ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName"
    351     ReadRegStr $R2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "DisplayVersion"
    352     ReadRegStr $R3 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentBuild"
    353     ReadRegDWORD $R4 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "UBR"
    354     SetRegView default
    355     ClearErrors
    356     ${TLog} "windows     : $R1 $R2 (build $R3.$R4)"
    357 
    358     ReadEnvStr $R1 "PROCESSOR_ARCHITECTURE"
    359     ReadEnvStr $R2 "PROCESSOR_ARCHITEW6432"
    360     ClearErrors
    361     ${If} $R2 == ""
    362         StrCpy $R2 "n/a"
    363     ${EndIf}
    364     ${TLog} "architecture: $R1 (native: $R2)"
    365 
    366     ${If} ${Silent}
    367         ${TLog} "mode        : silent (/S) -- the wizard pages never run, so distro, domain and proxy mode stay empty"
    368     ${EndIf}
    369 FunctionEnd
    370 
    371 ; The logs this installer cannot reach from Windows, named in install.log so
    372 ; whoever reads it knows what else to ask the merchant for.
    373 Function TalerLogWhereElse
    374     ${TLog} "see also: C:\Users\Public\taler-bat.log   (setup-wsl-debian.bat)"
    375     ${TLog} "see also: C:\Users\Public\taler-sh.log    (install-taler-from-apt.sh)"
    376     ${TLog} "see also: C:\Users\Public\install-bat.log (copied out of WSL at step 7)"
    377     ${TLog} "see also: /home/taleruser/taler-installer/install-sh.log (inside WSL)"
    378     ${TLog} "see also: /home/taleruser/taler-installer/test-db.log    (inside WSL)"
    379 FunctionEnd
    380 
    381 ; The MUI_LANGDLL_* defines above only configure the language selection
    382 ; dialog; it is shown solely by this macro.  Without a .onInit inserting it,
    383 ; NSIS picked the system language and fell back to the first one declared,
    384 ; so these translations were unreachable except on a matching Windows.
    385 Function .onInit
    386     !insertmacro MUI_LANGDLL_DISPLAY
    387     Call TalerLogStart
    388 FunctionEnd
    389 
    390 ; --- PAGE DISTRO ---
    391 Function DistroPage
    392     nsDialogs::Create 1018
    393     Pop $0
    394     ${If} $0 == error
    395         Abort
    396     ${EndIf}
    397     ${NSD_CreateLabel} 0 10u 100% 12u $(CHOOSE_DISTRO_LABEL)
    398     Pop $0
    399     ${NSD_CreateRadioButton} 0 30u 100% 12u "Debian"
    400     Pop $RADIO_DEBIAN
    401     ${NSD_CreateRadioButton} 0 45u 100% 12u "Ubuntu"
    402     Pop $RADIO_UBUNTU
    403     ${NSD_SetState} $RADIO_DEBIAN 1
    404     nsDialogs::Show
    405 FunctionEnd
    406 
    407 Function DistroPageLeave
    408     ${NSD_GetState} $RADIO_DEBIAN $0
    409     ${If} $0 == 1
    410         StrCpy $WSL_DISTRO "Debian"
    411     ${EndIf}
    412     ${NSD_GetState} $RADIO_UBUNTU $0
    413     ${If} $0 == 1
    414         StrCpy $WSL_DISTRO "Ubuntu"
    415     ${EndIf}
    416     ${If} $WSL_DISTRO == ""
    417         StrCpy $WSL_DISTRO "Debian"
    418     ${EndIf}
    419     ${TLog} "choice: distribution = $WSL_DISTRO"
    420 FunctionEnd
    421 
    422 ; --- PAGE DOMAINE ---
    423 Function DomainPage
    424     nsDialogs::Create 1018
    425     Pop $0
    426     ${If} $0 == error
    427         Abort
    428     ${EndIf}
    429     ${NSD_CreateLabel} 0 10u 100% 12u $(ENTER_DOMAIN)
    430     Pop $0
    431     ${NSD_CreateText} 0 25u 100% 12u ""
    432     Pop $DOMAIN_INPUT
    433     nsDialogs::Show
    434 FunctionEnd
    435 
    436 Function DomainPageLeave
    437     ${NSD_GetText} $DOMAIN_INPUT $0
    438     ${If} $0 == ""
    439         MessageBox MB_OK|MB_ICONEXCLAMATION $(MSG_DOMAIN_REQUIRED)
    440         Abort
    441     ${EndIf}
    442     ${If} $0 == "localhost"
    443         MessageBox MB_OK $(MSG_LOCALHOST_WARN)
    444         StrCpy $DOMAIN_VALUE $0
    445         ${TLog} "choice: domain = localhost (entered; not publicly reachable)"
    446         Return
    447     ${EndIf}
    448     StrCpy $1 0
    449     loop_ping:
    450         nsExec::ExecToStack 'ping -n 1 -w 1000 $0'
    451         ; ExecToStack pushes the output and then the exit code, so the code
    452         ; comes off first and the output has to be popped too; popping only
    453         ; the code left one entry per attempt on the global stack.  (nsExec
    454         ; pushes a single value instead only when it cannot build a command
    455         ; line at all, which needs an empty command string -- $0 is checked
    456         ; non-empty above, so that cannot happen here.)
    457         Pop $2
    458         Pop $3
    459         ${If} $2 == 0
    460             StrCpy $DOMAIN_VALUE $0
    461             ${TLog} "choice: domain = $DOMAIN_VALUE (ping answered)"
    462             Return
    463         ${Else}
    464             ${TLog} "ping of '$0' failed with code $2 (attempt $1)"
    465             MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(MSG_DOMAIN_PING_FAIL)" IDRETRY retry_ping IDCANCEL use_localhost
    466             retry_ping:
    467                 IntOp $1 $1 + 1
    468                 ${If} $1 < 3
    469                     Goto loop_ping
    470                 ${EndIf}
    471             use_localhost:
    472                 StrCpy $DOMAIN_VALUE "localhost"
    473                 ${TLog} "choice: domain = localhost (fallback, '$0' never answered)"
    474                 MessageBox MB_OK $(MSG_LOCALHOST_WARN)
    475         ${EndIf}
    476 FunctionEnd
    477 
    478 Function ReverseProxyPage
    479   nsDialogs::Create 1018
    480   Pop $0
    481   ${If} $0 == error
    482     Abort
    483   ${EndIf}
    484 
    485   ${NSD_CreateLabel} 0 10u 100% 12u $(MSG_REVERSE_PROXY_TITLE)
    486   Pop $0
    487 
    488   ${NSD_CreateRadioButton} 0 30u 100% 12u $(MSG_HTTP_ONLY)
    489   Pop $RADIO_HTTP_ONLY
    490 
    491   ${NSD_CreateRadioButton} 0 45u 100% 12u $(MSG_HTTPS)
    492   Pop $RADIO_HTTPS
    493 
    494   ; Récupère la valeur du domaine
    495   StrCpy $1 $DOMAIN_VALUE
    496 
    497   ${If} $1 == "localhost"
    498     ; HTTPS grisé, HTTP sélectionné
    499     EnableWindow $RADIO_HTTPS 0
    500     ${NSD_SetState} $RADIO_HTTP_ONLY 1
    501     ${NSD_SetState} $RADIO_HTTPS 0
    502   ${Else}
    503     ; Les deux actifs, HTTPS sélectionné par défaut
    504     EnableWindow $RADIO_HTTP_ONLY 1
    505     EnableWindow $RADIO_HTTPS 1
    506     ${NSD_SetState} $RADIO_HTTPS 1
    507     ${NSD_SetState} $RADIO_HTTP_ONLY 0
    508   ${EndIf}
    509 
    510   nsDialogs::Show
    511 FunctionEnd
    512 
    513 Function ReverseProxyPageLeave
    514   ${NSD_GetState} $RADIO_HTTP_ONLY $0
    515   ${If} $0 == 1
    516     StrCpy $REVERSE_PROXY_MODE "http"
    517   ${Else}
    518     StrCpy $REVERSE_PROXY_MODE "https"
    519   ${EndIf}
    520   ${TLog} "choice: reverse proxy = $REVERSE_PROXY_MODE"
    521 FunctionEnd
    522 
    523 ; -------- SECTION INSTALL PRINCIPALE --------
    524 Section "Install Taler-Merchant"
    525     StrCpy $INSTALL_OK "1"
    526     ${TLog} "=== install section started ==="
    527     SetOutPath "$INSTDIR"
    528     SetDetailsView show
    529     File "setup-wsl-debian.bat"
    530     File "get-wsl-msi.ps1"
    531     File "install-taler-from-apt.sh"
    532     File "test-db.sh"
    533     File "set-db.sh"
    534 
    535     FindWindow $0 "#32770" "" $HWNDPARENT
    536     GetDlgItem $HWND_PROGRESS_LABEL $0 1006
    537 
    538     DetailPrint "---------------------------------------------------------"
    539     ${TSay} "[1/8] Enabling WSL and VirtualMachinePlatform..."
    540     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 5%"
    541     Sleep 2000
    542 
    543     MessageBox MB_OK|MB_ICONINFORMATION $(MSG_STEP1)
    544 
    545     DetailPrint "[INFO] This is the slowest step. Please be patient."
    546     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 8%"
    547     Sleep 5000
    548 
    549     DetailPrint "[INFO] Do NOT close the installer. The process will continue automatically."
    550     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 12%"
    551     Sleep 5000
    552 
    553     DetailPrint "[INFO] Windows is still enabling the required features..."
    554     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 16%"
    555     Sleep 5000
    556 
    557     DetailPrint "[INFO] This is normal. Please wait, your system is working in the background."
    558     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 20%"
    559     Sleep 5000
    560 
    561     nsExec::ExecToLog '"$INSTDIR\setup-wsl-debian.bat" 1 "" $WSL_DISTRO'
    562     Pop $0
    563     ${TLog} "step 1 (enable the WSL optional features) returned $0"
    564     ${If} $0 != 0
    565         ${TLog} "=== stopping: the machine must reboot before the install can continue ==="
    566         MessageBox MB_OK $(MSG_NEED_REBOOT)
    567         Quit
    568     ${EndIf}
    569 
    570     MessageBox MB_OK $(MSG_UPDATE_WSL)
    571 
    572     DetailPrint "[INFO] WSL and VirtualMachinePlatform are enabled. Checking for WSL updates..."
    573     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 30%"
    574     DetailPrint "NOTICE: A black window may appear for the WSL update. If it does, simply press any key when prompted."
    575     Sleep 1000
    576 
    577     ; [2/8] to [6/8] are cosmetic: the work for all of them happens inside the
    578     ; single "ALL" call below, so they are deliberately NOT written to
    579     ; install.log.  A log claiming six steps that never individually ran would
    580     ; be worse than no log at all.
    581     DetailPrint "[2/8] Installing $WSL_DISTRO..."
    582     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 35%"
    583     Sleep 1000
    584 
    585     DetailPrint "[3/8] Creating $WSL_DISTRO user..."
    586     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 45%"
    587     Sleep 1000
    588 
    589     DetailPrint "[4/8] Adding user to www-data group..."
    590     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 55%"
    591     Sleep 1000
    592 
    593     DetailPrint "[5/8] Copying installer script..."
    594     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 60%"
    595     Sleep 1000
    596 
    597     DetailPrint "[6/8] Converting script format and setting permissions..."
    598     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 65%"
    599     Sleep 1000
    600 
    601     ${TSay} "[7/8] Restarting WSL and launching installation..."
    602     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 70%"
    603     ${TLog} "running setup-wsl-debian.bat ALL (distro $WSL_DISTRO) -- this is steps 1 to 8"
    604     nsExec::ExecToLog '"$INSTDIR\setup-wsl-debian.bat" ALL "" $WSL_DISTRO'
    605     Pop $0
    606     ${TLog} "setup-wsl-debian.bat ALL returned $0"
    607     ${If} $0 != 0
    608         ${TSay} "ERROR: the installation step failed with code $0."
    609         StrCpy $INSTALL_OK "0"
    610     ${EndIf}
    611 
    612     ${TSay} "[8/8] Configuring reverse proxy for $DOMAIN_VALUE in $REVERSE_PROXY_MODE mode..."
    613     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 80%"
    614     nsExec::ExecToLog '"$INSTDIR\setup-wsl-debian.bat" 8 $DOMAIN_VALUE $WSL_DISTRO $REVERSE_PROXY_MODE'
    615     Pop $0
    616     ${TLog} "step 8 (reverse proxy, $REVERSE_PROXY_MODE, domain $DOMAIN_VALUE) returned $0"
    617     ${If} $0 != 0
    618         ${TSay} "ERROR: configuring the reverse proxy failed with code $0."
    619         StrCpy $INSTALL_OK "0"
    620     ${EndIf}
    621 
    622     ${TSay} "Testing access to merchant reverse proxy..."
    623     nsExec::ExecToLog 'wsl -d $WSL_DISTRO -- bash -c "curl -v http://localhost"'
    624     ; This result used to be dropped on the floor -- never popped, so the
    625     ; diagnostic was lost and the value stayed on the global stack.  It is the
    626     ; one end-to-end check the installer makes, so it belongs in the log.
    627     Pop $0
    628     ${TLog} "probe: curl http://localhost inside WSL returned $0 (0 = the proxy answered)"
    629     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 85%"
    630     Sleep 2000
    631 
    632     DetailPrint "Checking passed domain in $WSL_DISTRO..."
    633     nsExec::ExecToLog 'wsl -d $WSL_DISTRO -- bash -c "echo Received domain: '\''$DOMAIN_VALUE'\''"'
    634     Pop $0
    635     ${TLog} "probe: wsl -d $WSL_DISTRO runs commands: returned $0"
    636     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 90%"
    637     Sleep 2000
    638 
    639     SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 99%"
    640     Sleep 1000
    641     ${If} $INSTALL_OK == "1"
    642         ${TSay} "Installation complete."
    643         SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 100%"
    644     ${Else}
    645         ${TSay} "Installation FAILED - see ${TALER_LOGFILE}"
    646         SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Installation failed"
    647         MessageBox MB_OK|MB_ICONSTOP $(MSG_INSTALL_FAILED)
    648     ${EndIf}
    649     ${TLog} "=== install section finished, INSTALL_OK = $INSTALL_OK ==="
    650     Call TalerLogWhereElse
    651     CreateShortCut "$SMPROGRAMS\Taler-Merchant.lnk" "$INSTDIR\taler-installer.exe"
    652 SectionEnd
    653 
    654 ; -------- PAGE DB CHOIX (avant URL) --------
    655 Function AskExternalDBPage
    656     nsDialogs::Create 1018
    657     Pop $0
    658     ${If} $0 == error
    659         Abort
    660     ${EndIf}
    661     ${NSD_CreateLabel} 10u 10u 80% 12u $(ASK_DB_LABEL)
    662     Pop $1
    663     ${NSD_CreateRadioButton} 10u 35u 80u 12u $(ASK_DB_YES)
    664     Pop $ASK_DB_YESNO
    665     ${NSD_CreateRadioButton} 10u 55u 80u 12u $(ASK_DB_NO)
    666     Pop $0
    667     ${NSD_SetState} $0 1   ; "No" checked by default
    668     nsDialogs::Show
    669 FunctionEnd
    670 
    671 Function AskExternalDBPageLeave
    672     ${NSD_GetState} $ASK_DB_YESNO $0
    673     ${If} $0 == 1
    674         StrCpy $USE_EXTERNAL_DB "1"
    675         ${TLog} "choice: external PostgreSQL database = yes"
    676     ${Else}
    677         StrCpy $USE_EXTERNAL_DB "0"
    678         ${TLog} "choice: external PostgreSQL database = no, keep the local one"
    679     ${EndIf}
    680     Return
    681 FunctionEnd
    682 
    683 ; -------- PAGE FORMULAIRE URL DB (apparait si Oui) --------
    684 Function DBUrlPage
    685     ${If} $USE_EXTERNAL_DB != "1"
    686         Abort
    687     ${EndIf}
    688     nsDialogs::Create 1018
    689     Pop $0
    690     ${If} $0 == error
    691         Abort
    692     ${EndIf}
    693     ${NSD_CreateLabel} 0 10u 100% 12u $(ENTER_DB_URL_LABEL)
    694     Pop $1
    695     ${NSD_CreateText} 0 25u 100% 12u ""
    696     Pop $DBCONFIG_INPUT
    697     nsDialogs::Show
    698 FunctionEnd
    699 
    700 Function DBUrlPageLeave
    701     ${If} $USE_EXTERNAL_DB != "1"
    702         Return
    703     ${EndIf}
    704     ${NSD_GetText} $DBCONFIG_INPUT $DB_URL
    705 
    706     ${If} $DB_URL == ""
    707         MessageBox MB_OK|MB_ICONEXCLAMATION $(DB_URL_REQUIRED)
    708         Abort
    709     ${EndIf}
    710 
    711     StrCpy $WSL_SCRIPT_DIR "/home/taleruser/taler-installer"
    712 
    713     ; $DB_URL holds the database password.  It used to be echoed verbatim into
    714     ; the details view; it must not go there, nor into install.log.  Report the
    715     ; host and database only.
    716     Push $DB_URL
    717     Call RedactDbUrl
    718     Pop $1
    719     ${TSay} "Testing connection to the external database at $1..."
    720 
    721     nsExec::ExecToStack 'wsl -d $WSL_DISTRO -- bash -c "/home/taleruser/taler-installer/test-db.sh ''$DB_URL''"'
    722     Pop $0
    723     ; test-db.sh echoes back the URL it was handed, password and all, so its
    724     ; output is popped off the stack and dropped rather than logged.
    725     Pop $2
    726     ${TLog} "test-db.sh returned $0 (0 = reachable, 1 = refused, 2 = psql missing in WSL)"
    727 
    728     ${If} $0 == 0
    729         ${TSay} "Connection succeeded. Updating configuration..."
    730         nsExec::ExecToStack 'wsl -d $WSL_DISTRO -- bash -c "/home/taleruser/taler-installer/set-db.sh ''$DB_URL''"'
    731         ; set-db.sh writes the secret snippet and then runs
    732         ; taler-merchant-dbconfig.  Its result was previously discarded and
    733         ; success announced regardless, so a database that was reachable but
    734         ; could not be configured still reported "configured successfully".
    735         Pop $0
    736         Pop $2
    737         ${TLog} "set-db.sh returned $0"
    738     ${Else}
    739         ${TLog} "the external database is not reachable; no configuration was written"
    740     ${EndIf}
    741 
    742     ${If} $0 == 0
    743         ${TLog} "external database configured: $1"
    744         MessageBox MB_OK $(DB_CONN_OK)
    745     ${Else}
    746         ${TSay} "ERROR: the external database was not configured (code $0)."
    747         MessageBox MB_RETRYCANCEL $(DB_CONN_FAIL) IDRETRY retry_dburl IDCANCEL fin_dburl
    748         retry_dburl:
    749             Abort
    750         fin_dburl:
    751     ${EndIf}
    752     Return
    753 FunctionEnd
    754 
    755 ; ---- PAGE FINISH : open browser ----
    756 Function .onGUIEnd
    757     ; This runs on every exit from the GUI, including a cancel and a failed run,
    758     ; so announcing success here unconditionally told operators the install had
    759     ; worked when it had not.  Only celebrate when the section actually succeeded.
    760     ${If} $INSTALL_OK != "1"
    761         ${TLog} "=== GUI closed without a successful install ==="
    762         Return
    763     ${EndIf}
    764 
    765     ${TLog} "=== install reported success ==="
    766     MessageBox MB_OK|MB_ICONINFORMATION $(MSG_DONE_OPEN_BROWSER)
    767 
    768     ; Force WSL à démarrer Apache AVANT le navigateur
    769     nsExec::ExecToLog 'wsl -d $WSL_DISTRO -- bash -c "sudo service apache2 restart"'
    770     Pop $0
    771     ${TLog} "apache2 restart returned $0"
    772     Sleep 2000
    773 
    774     ${If} $REVERSE_PROXY_MODE == "https"
    775         ${TLog} "opening https://$DOMAIN_VALUE"
    776         ExecShell "open" "https://$DOMAIN_VALUE"
    777     ${Else}
    778         ${TLog} "opening http://$DOMAIN_VALUE"
    779         ExecShell "open" "http://$DOMAIN_VALUE"
    780     ${EndIf}
    781 FunctionEnd
    782 
    783 ; Logged so that a report of "it just closed" can be told from a crash.
    784 ; Called by MUI's .onUserAbort via MUI_CUSTOMFUNCTION_ABORT.
    785 Function TalerOnAbort
    786     ${TLog} "=== cancelled by the user ==="
    787 FunctionEnd
    788 
    789 Function .onInstFailed
    790     ${TLog} "=== installation aborted (.onInstFailed) ==="
    791     Call TalerLogWhereElse
    792     MessageBox MB_OK $(MSG_INSTALL_FAILED)
    793     ExecShell "open" "${TALER_LOGFILE}"
    794 FunctionEnd