taler-windows

Windows packaging
Log | Files | Refs

commit 57dc02485873122e1154d77995c83f83e2aca152
parent 1b57b0d1927b3c2f89d9fc5011700e85efa859ee
Author: Leayawi <lea.oualli@outlook.fr>
Date:   Mon,  2 Jun 2025 15:44:11 +0200

readme 1.0

Diffstat:
Areadme.txt | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dtest posgress ext/install-taler-from-apt.sh | 137-------------------------------------------------------------------------------
Dtest posgress ext/logo-header.bmp | 0
Dtest posgress ext/logo-header.ico | 0
Dtest posgress ext/logo-welcome.bmp | 0
Dtest posgress ext/run-admin.bat | 18------------------
Dtest posgress ext/setup-post-wsl.bat | 82-------------------------------------------------------------------------------
Dtest posgress ext/setup-pre-wsl.bat | 104-------------------------------------------------------------------------------
Dtest posgress ext/taler-installer-taler.nsi | 396-------------------------------------------------------------------------------
Dtest posgress ext/test-pgurl.bat | 14--------------
10 files changed, 87 insertions(+), 751 deletions(-)

diff --git a/readme.txt b/readme.txt @@ -0,0 +1,86 @@ +GNU Taler-Merchant Backend for Windows (NSIS Installer) +Overview + +This project provides a Windows graphical installer (NSIS) to easily deploy the GNU Taler-Merchant backend on Windows using the Windows Subsystem for Linux (WSL) with Debian or Ubuntu. The installer guides the user step by step through the installation and setup process, requiring minimal manual intervention. +Features + + Automated installation of WSL and the chosen Linux distribution (Debian or Ubuntu) + + Guided selection of domain and reverse proxy mode (HTTP or HTTPS) + + Installs and configures GNU Taler-Merchant backend inside WSL + + Multi-language support: English and French + + User-friendly GUI with branding and progress messages + + Automatic reboot handling if required + +Prerequisites + + Windows 10 or 11 with administrator privileges + + Internet connection + + No pre-existing WSL installation required (the installer handles everything) + + No services running on ports 80/443 if using HTTP/HTTPS + +Files Included +File Name Description +taler-installer.exe Main Windows installer (NSIS executable) +taler-installer-taler.nsi NSIS script source code +setup-wsl-debian.bat Windows batch script for enabling WSL & installing Debian/Ubuntu +install-taler-from-apt.sh Bash script run inside WSL to install Taler-Merchant +logo-header.ico/.bmp Installer icons and header images +logo-welcome.bmp Welcome page image +Installation Steps + + Clone or download this repository on your Windows machine. + + Run taler-installer.exe as administrator (right-click → "Run as administrator"). + + Select the desired Linux distribution (Debian or Ubuntu). + + Enter the domain name for your Taler-Merchant instance (localhost can be used for testing or local-only installs). + + Choose the reverse proxy mode: HTTP or HTTPS. + + The installer will automatically: + + Enable WSL and install the chosen Linux distribution. + + Copy and execute scripts inside the WSL environment. + + Install and configure GNU Taler-Merchant backend. + + At the end, the installer offers to open the Taler-Merchant web interface in your browser. + +If a system reboot is required (for WSL activation), the installer will prompt you and provide a "Restart now" button. +Important Notes + + No external PostgreSQL database setup is included in this version. The backend will use the default local PostgreSQL setup. + + For public domain/HTTPS usage, ensure your DNS and firewall are configured properly. + + Installation logs are written to C:\Users\Public\install.log in case of errors. + +Uninstallation + +To remove, simply delete the installation folder. You can also uninstall WSL from Windows settings if you no longer need it. +Customization + + The NSIS script (taler-installer-taler.nsi) can be edited to add more options (e.g., advanced DB config, custom logos, more languages, etc). + + All branding images can be replaced as needed. + +License + +This installer is part of GNU Taler. +Copyright © 2025 Taler Systems SA + +GNU Taler is free software, released under the GNU Lesser General Public License (LGPL) v2.1+. + +Author: +Léa Oualli +Taler Systems SA +\ No newline at end of file diff --git a/test posgress ext/install-taler-from-apt.sh b/test posgress ext/install-taler-from-apt.sh @@ -1,137 +0,0 @@ -#!/bin/bash -# This file is part of GNU Taler. -# Copyright (C) 2025 Taler Systems SA -# -# TALER is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License as published by the Free Software -# Foundation; either version 2.1, or (at your option) any later version. -# -# TALER is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License along with -# TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -# -# Author: Léa Oualli - -set -e -set -x -trap 'echo "Error occurred on line $LINENO." >&2' ERR -exec > >(tee -a /tmp/install-output.log) 2>&1 - -WSL_USER="taleruser" -TALER_DB_USER="taler-merchant-httpd" - -############################################# -# -------- HTTPS / Reverse Proxy -----------# -############################################# -# Si le script est appelé avec "8" et un domaine, on ne fait QUE la config HTTPS/proxy : -if [ "$1" = "8" ] && [ -n "$2" ]; then - DOMAIN="$2" - echo "Configuring HTTPS reverse proxy for domain: $DOMAIN" - if ! sudo taler-merchant-rproxy-setup --acme --merchant-url="https://$DOMAIN:8888/"; then - echo "WARNING: Impossible d’obtenir un certificat HTTPS valide pour $DOMAIN (vérifie le DNS, les ports 80/443, et Internet)" | tee -a "/home/$WSL_USER/taler-installer/install.log" - # On ne bloque pas toute l'install, on log juste le problème - exit 0 - fi - echo "HTTPS reverse proxy configured for $DOMAIN" | tee -a "/home/$WSL_USER/taler-installer/install.log" - exit 0 -fi -############################################# - -# Vérification de l'utilisateur système -if ! id "$WSL_USER" &>/dev/null; then - echo "System user $WSL_USER not found. Please create it." >&2 - exit 1 -fi - -echo "Adding user $WSL_USER to www-data group..." -sudo usermod -aG www-data $WSL_USER || { - echo "Failed to add $WSL_USER to www-data group." >&2 - exit 1 -} - -sudo apt-get update -sudo apt-get install -y gnupg wget curl lsb-release apt-transport-https ca-certificates || { - echo "Base dependencies installation failed." >&2 - exit 1 -} - -sudo apt-get install -y postgresql || { - echo "PostgreSQL installation failed." >&2 - exit 1 -} - -sudo systemctl enable postgresql -sudo systemctl start postgresql - -echo "Creating PostgreSQL user $WSL_USER..." -sudo -u postgres createuser --createdb "$WSL_USER" || echo "User $WSL_USER already exists, continuing..." - -echo "Creating PostgreSQL user $TALER_DB_USER..." -sudo -u postgres createuser --createdb "$TALER_DB_USER" || echo "User $TALER_DB_USER already exists, continuing..." - -echo "Adding GNU Taler repository..." - -# --- DÉTECTION DE LA DISTRIBUTION ET AJOUT DU BON DÉPÔT --- -DISTRO="$(lsb_release -is 2>/dev/null || echo Debian)" -CODENAME="$(lsb_release -cs 2>/dev/null || echo bookworm)" -sudo mkdir -p /etc/apt/keyrings - -# Importe la clé -curl -fsSL https://taler.net/taler-systems.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/taler-systems.gpg > /dev/null - -if [ "$DISTRO" = "Ubuntu" ]; then - echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/ubuntu/ $CODENAME main" \ - | sudo tee /etc/apt/sources.list.d/taler.list -else - echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian/ $CODENAME main" \ - | sudo tee /etc/apt/sources.list.d/taler.list -fi - -# --------------------------------------------------------- - -sudo apt-get update -sudo apt-get install -y taler-merchant || { - echo "GNU Taler installation failed." >&2 - exit 1 -} - -PGURL="$1" -sudo mkdir -p /etc/taler - -if [ -n "$PGURL" ]; then - # Si une URL est passée en paramètre, on la met dans la conf - echo "[merchant] -PORT = 8888 -UNIX_DOMAIN_SOCKETS = NO -DB = $PGURL" | sudo tee /etc/taler-merchant/taler-merchant.conf -else - # Sinon, conf locale classique - echo "[merchant] -PORT = 8888 -UNIX_DOMAIN_SOCKETS = NO" | sudo tee /etc/taler-merchant/taler-merchant.conf -fi - -echo "Initializing database with taler-merchant-dbconfig..." -if ! sudo taler-merchant-dbconfig; then - echo "Error during taler-merchant-dbconfig" >&2 - exit 1 -fi - -echo "Enabling taler-merchant.target..." -sudo systemctl enable taler-merchant.target -sudo systemctl restart taler-merchant.target - -echo "Also enabling TCP service on port 8888..." -sudo systemctl enable taler-merchant-httpd.service -sudo systemctl restart taler-merchant-httpd.service - -echo "Checking taler-merchant status..." -sudo systemctl status taler-merchant-httpd.service --no-pager || true -sudo systemctl status taler-merchant-httpd.socket --no-pager || true - -mkdir -p "/home/$WSL_USER/taler-installer" -sudo chown -R "$WSL_USER:$WSL_USER" "/home/$WSL_USER/taler-installer" -echo "GNU Taler-Merchant installed successfully via system config" | tee "/home/$WSL_USER/taler-installer/install.log" diff --git a/test posgress ext/logo-header.bmp b/test posgress ext/logo-header.bmp Binary files differ. diff --git a/test posgress ext/logo-header.ico b/test posgress ext/logo-header.ico Binary files differ. diff --git a/test posgress ext/logo-welcome.bmp b/test posgress ext/logo-welcome.bmp Binary files differ. diff --git a/test posgress ext/run-admin.bat b/test posgress ext/run-admin.bat @@ -1,18 +0,0 @@ -@echo off -:: This file is part of GNU Taler. -:: Copyright (C) 2025 Taler Systems SA -:: -:: TALER is free software; you can redistribute it and/or modify it under the -:: terms of the GNU Lesser General Public License as published by the Free Software -:: Foundation; either version 2.1, or (at your option) any later version. -:: -:: TALER is distributed in the hope that it will be useful, but WITHOUT ANY -:: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -:: A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -:: -:: You should have received a copy of the GNU Lesser General Public License along with -:: TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -:: -:: Author: Léa Oualli - -powershell -Command "Start-Process cmd.exe -ArgumentList '/c \"%~dp0setup-wsl-debian.bat\"' -Verb RunAs" diff --git a/test posgress ext/setup-post-wsl.bat b/test posgress ext/setup-post-wsl.bat @@ -1,82 +0,0 @@ -@echo off -:: This file is part of GNU Taler. -:: Copyright (C) 2025 Taler Systems SA -:: -:: TALER is free software; you can redistribute it and/or modify it under the -:: terms of the GNU Lesser General Public License as published by the Free Software -:: Foundation; either version 2.1, or (at your option) any later version. -:: -:: TALER is distributed in the hope that it will be useful, but WITHOUT ANY -:: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -:: A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -:: -:: You should have received a copy of the GNU Lesser General Public License along with -:: TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -:: -:: Author: Léa Oualli - -setlocal enabledelayedexpansion - -set WSL=%WINDIR%\Sysnative\wsl.exe -set WSL_USER=taleruser -set STEP=%1 -set DISTRO=%2 -set DOMAIN=%3 -set PROXY_MODE=%4 -set PGURL=%5 - -if "%STEP%"=="" ( - set STEP=ALL -) - -if "%DISTRO%"=="" ( - set DISTRO=Debian -) - -if "%STEP%"=="5" goto step5 -if "%STEP%"=="6" goto step6 -if "%STEP%"=="7" goto step7 -if "%STEP%"=="8" goto step8 - -:step5 -echo [5/8] Copying installer script... -copy /Y "%~dp0install-taler-from-apt.sh" "%TEMP%\install-taler-from-apt.sh" -%WSL% -d %DISTRO% -- bash -c "sudo mkdir -p /home/%WSL_USER%/taler-installer" -%WSL% -d %DISTRO% -- bash -c "sudo rm -f /home/%WSL_USER%/taler-installer/install-taler-from-apt.sh" -type "%TEMP%\install-taler-from-apt.sh" | %WSL% -d %DISTRO% -- bash -c "sudo tee /home/%WSL_USER%/taler-installer/install-taler-from-apt.sh >nul" -if not "%STEP%"=="ALL" exit /b - -:step6 -echo [6/8] Setting permissions... -%WSL% -d %DISTRO% -- bash -c "sudo apt-get update && sudo apt-get install -y dos2unix" -%WSL% -d %DISTRO% -- bash -c "sudo dos2unix /home/%WSL_USER%/taler-installer/install-taler-from-apt.sh" -%WSL% -d %DISTRO% -- bash -c "sudo chmod +x /home/%WSL_USER%/taler-installer/install-taler-from-apt.sh" -if not "%STEP%"=="ALL" exit /b - -:step7 -echo [7/8] Restarting WSL and running installer... -%WSL% --shutdown -timeout /t 3 - -:: Lancer le script principal avec l’URL PG et log (note : échappe bien les arguments si besoin) -%WSL% -d %DISTRO% -- bash -c "sudo -u %WSL_USER% bash /home/%WSL_USER%/taler-installer/install-taler-from-apt.sh '%PGURL%' | tee /home/%WSL_USER%/taler-installer/install.log" -%WSL% -d %DISTRO% -- bash -c "sudo cp /home/%WSL_USER%/taler-installer/install.log /mnt/c/Users/Public/install.log" -if not "%STEP%"=="ALL" exit /b - -:step8 -echo [8/8] Configuring reverse proxy... - -if "%DOMAIN%"=="" set DOMAIN=localhost - -if /I "%PROXY_MODE%"=="HTTPS" ( - echo Setting up HTTPS with Let's Encrypt for %DOMAIN% ... - %WSL% -d %DISTRO% -- bash -c "sudo taler-merchant-rproxy-setup --acme --merchant-url='https://%DOMAIN%:8888/'" -) else ( - echo Setting up HTTP only for %DOMAIN% ... - %WSL% -d %DISTRO% -- bash -c "sudo taler-merchant-rproxy-setup --domain %DOMAIN% --httponly" -) - -REM Démarrer Apache si nécessaire... -%WSL% -d %DISTRO% -- bash -c "sudo service apache2 start" - -exit /b diff --git a/test posgress ext/setup-pre-wsl.bat b/test posgress ext/setup-pre-wsl.bat @@ -1,104 +0,0 @@ -@echo off -:: This file is part of GNU Taler. -:: Copyright (C) 2025 Taler Systems SA -:: -:: TALER is free software; you can redistribute it and/or modify it under the -:: terms of the GNU Lesser General Public License as published by the Free Software -:: Foundation; either version 2.1, or (at your option) any later version. -:: -:: TALER is distributed in the hope that it will be useful, but WITHOUT ANY -:: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -:: A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -:: -:: You should have received a copy of the GNU Lesser General Public License along with -:: TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -:: -:: Author: Léa Oualli - -setlocal enabledelayedexpansion -set WSL=%WINDIR%\Sysnative\wsl.exe -set WSL_USER=taleruser -set STEP=%1 -set DOMAIN=%2 -set DISTRO=%3 -set PROXY_MODE=%4 - -if "%STEP%"=="" ( - set STEP=ALL -) - -if "%DISTRO%"=="" ( - set DISTRO=Debian -) - -if "%STEP%"=="1" goto step1 -if "%STEP%"=="2" goto step2 -if "%STEP%"=="3" goto step3 -if "%STEP%"=="4" goto step4 - - -:step1 -echo [1/8] Checking if WSL and VirtualMachinePlatform are enabled... - -:: Check if WSL is enabled -powershell -Command "(Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux).State" | find /I "Enabled" >nul -set WSL_ENABLED=%errorlevel% -:: Check if VirtualMachinePlatform is enabled -powershell -Command "(Get-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform).State" | find /I "Enabled" >nul -set VMP_ENABLED=%errorlevel% - -if %WSL_ENABLED% equ 0 ( - echo WSL is already enabled. -) else ( - echo Enabling WSL feature... - powershell.exe -Command "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart" - set NEED_REBOOT=1 -) - -if %VMP_ENABLED% equ 0 ( - echo VirtualMachinePlatform is already enabled. -) else ( - echo Enabling VirtualMachinePlatform feature... - powershell.exe -Command "Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart" - set NEED_REBOOT=1 -) - -if defined NEED_REBOOT ( - echo. - echo [INFO] A restart is required to finish enabling WSL features. Please restart your computer and run the installer again. - pause - exit /b 1 -) else ( - echo [INFO] WSL and VirtualMachinePlatform are ready. -) - -if not "%STEP%"=="ALL" exit /b - -echo [INFO] Updating WSL to the latest version if needed... -echo [INFO] If a black window appears, please press any key when prompted, then wait until the window closes automatically. -echo [INFO] The installation will continue automatically after the update. -timeout /t 3 /nobreak - -:: Use start /wait to ensure the script waits for the update to finish (including if user has to press a key) -start /wait "" %WSL% --update - -if not "%STEP%"=="ALL" exit /b - -:step2 -echo [2/8] Installing %DISTRO%... -%WSL% --install -d %DISTRO% -timeout /t 20 /nobreak - -echo Initializing %DISTRO% first launch... -%WSL% -d %DISTRO% -- bash -c "echo %DISTRO% ready" -if not "%STEP%"=="ALL" exit /b - -:step3 -echo [3/8] Creating %DISTRO% user if needed... -%WSL% -d %DISTRO% -- bash -c "id %WSL_USER% >/dev/null 2>&1 || (sudo useradd -m %WSL_USER% && echo '%WSL_USER% ALL=(ALL) NOPASSWD:ALL' | sudo tee -a /etc/sudoers)" -if not "%STEP%"=="ALL" exit /b - -:step4 -echo [4/8] Adding user to www-data group... -%WSL% -d %DISTRO% -- bash -c "sudo usermod -aG www-data %WSL_USER% || echo 'Warning: Could not add user to www-data (might already be a member)'" -if not "%STEP%"=="ALL" exit /b diff --git a/test posgress ext/taler-installer-taler.nsi b/test posgress ext/taler-installer-taler.nsi @@ -1,396 +0,0 @@ -; This file is part of GNU Taler. -; Copyright (C) 2025 Taler Systems SA -; -; TALER is free software; you can redistribute it and/or modify it under the -; terms of the GNU Lesser General Public License as published by the Free Software -; Foundation; either version 2.1, or (at your option) any later version. -; -; TALER is distributed in the hope that it will be useful, but WITHOUT ANY -; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -; A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public License along with -; TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -; -; Author: Léa Oualli - -Unicode true - -!include "MUI2.nsh" -!include "LogicLib.nsh" -!include "FileFunc.nsh" -!include "WinMessages.nsh" -!include "nsDialogs.nsh" - -!define MUI_ABORTWARNING -!define MUI_LANGDLL_DISPLAY -!define MUI_LANGDLL_REGISTRY_ROOT "HKCU" -!define MUI_LANGDLL_REGISTRY_KEY "Software\TalerInstaller" -!define MUI_LANGDLL_REGISTRY_VALUENAME "InstallerLanguage" - -Name "Taler-Merchant backend" -Outfile "taler-installer.exe" -InstallDir "$PROGRAMFILES\TalerMerchant" -RequestExecutionLevel admin - -Icon "logo-header.ico" -!define MUI_ICON "logo-header.ico" -!define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_RIGHT -!define MUI_HEADERIMAGE_BITMAP "logo-header.bmp" -!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH -!define MUI_WELCOMEFINISHPAGE_BITMAP "logo-welcome.bmp" - -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_DIRECTORY -Page custom DistroPage DistroPageLeave -Page custom DomainPage DomainPageLeave -Page custom ReverseProxyPage ReverseProxyPageLeave -!insertmacro MUI_PAGE_INSTFILES - -; -------- LangString FINISH_LINK ici, UNE SEULE FOIS ------------ -LangString MSG_FINISH_LINK 1033 "Open merchant web interface after installation" -LangString MSG_FINISH_LINK 1036 "Ouvrir l'interface web du marchand apres l'installation" - -!define MUI_FINISHPAGE_SHOWREADME -!define MUI_FINISHPAGE_SHOWREADME_FUNCTION OpenBrowser -!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(MSG_FINISH_LINK)" -!insertmacro MUI_PAGE_FINISH -; --------------------------------------------------------------- - -!insertmacro MUI_LANGUAGE "English" -!insertmacro MUI_LANGUAGE "French" - -Var /GLOBAL HWND_PROGRESS_LABEL -Var /GLOBAL DOMAIN_INPUT -Var /GLOBAL WSL_DISTRO -Var /GLOBAL RADIO_DEBIAN -Var /GLOBAL RADIO_UBUNTU -Var /GLOBAL REVERSE_PROXY_MODE -Var /GLOBAL RADIO_HTTP_ONLY -Var /GLOBAL RADIO_HTTPS -Var /GLOBAL PGURL_INPUT - -LangString MSG_WELCOME_TITLE ${LANG_ENGLISH} "GNU Taler-Merchant backend for Windows" -LangString MSG_WELCOME_TITLE ${LANG_FRENCH} "Backend GNU Taler-Merchant pour Windows" - -LangString MSG_WELCOME_TEXT ${LANG_ENGLISH} "This wizard will install GNU Taler-Merchant using WSL and Debian or Ubuntu." -LangString MSG_WELCOME_TEXT ${LANG_FRENCH} "Cet assistant va installer GNU Taler-Merchant avec WSL et Debian ou Ubuntu." - -LangString ENTER_DOMAIN ${LANG_ENGLISH} "Enter the domain name:" -LangString ENTER_DOMAIN ${LANG_FRENCH} "Entrez le nom de domaine :" - -LangString MSG_DOMAIN_REQUIRED ${LANG_ENGLISH} "Please enter a domain name." -LangString MSG_DOMAIN_REQUIRED ${LANG_FRENCH} "Veuillez saisir un nom de domaine." - -LangString MSG_LOCALHOST_WARN ${LANG_ENGLISH} "Warning: using 'localhost' means your merchant will not be publicly accessible." -LangString MSG_LOCALHOST_WARN ${LANG_FRENCH} "Attention : utiliser 'localhost' signifie que votre marchand ne sera pas accessible publiquement." - -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." -LangString MSG_STEP1 ${LANG_FRENCH} "Etape 1 : Activation de WSL et VirtualMachinePlatform.$\r$\n$\r$\nC'est l'etape la plus lente et cela peut prendre plusieurs minutes (jusqu'a 10 minutes sur certains ordinateurs).$\r$\n$\r$\nVeuillez NE PAS fermer l'installateur. La barre de progression peut sembler bloquee.$\r$\n$\r$\nL'installation continuera automatiquement des que cette etape sera terminee." - -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." -LangString MSG_NEED_REBOOT ${LANG_FRENCH} "Les fonctionnalites WSL viennent d'etre activees. Vous devez redemarrer votre ordinateur MAINTENANT pour poursuivre l'installation. Relancez cet installateur apres redemarrage." - -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." -LangString MSG_UPDATE_WSL ${LANG_FRENCH} "Une fenetre de mise a jour Windows va apparaitre pour mettre a jour WSL. Suivez les instructions et appuyez sur une touche si demande. Cliquez sur OK pour continuer." - -LangString MSG_INSTALL_FAILED ${LANG_ENGLISH} "Installation failed. Opening install.log..." -LangString MSG_INSTALL_FAILED ${LANG_FRENCH} "L'installation a echoue. Ouverture du fichier install.log..." - -; Reverse proxy (HTTPS/HTTP) texts -LangString MSG_REVERSE_PROXY_TITLE ${LANG_ENGLISH} "Select reverse proxy mode:" -LangString MSG_REVERSE_PROXY_TITLE ${LANG_FRENCH} "Choisissez le mode du reverse proxy :" - -LangString MSG_HTTP_ONLY ${LANG_ENGLISH} "HTTP only" -LangString MSG_HTTP_ONLY ${LANG_FRENCH} "HTTP uniquement" - -LangString MSG_HTTPS ${LANG_ENGLISH} "HTTPS" -LangString MSG_HTTPS ${LANG_FRENCH} "HTTPS" - -LangString MSG_DOMAIN_PING_FAIL ${LANG_FRENCH} "Le domaine '$0' ne repond pas au ping.$\r$\n$\r$\nCliquez sur Retry pour reessayer ce domaine, ou Cancel pour utiliser 'localhost'. Pour changer de domaine, cliquez sur Precedent." -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." - -LangString MSG_PGURL_LABEL ${LANG_ENGLISH} "Enter your PostgreSQL connection URL (leave blank to use a local database):" -LangString MSG_PGURL_LABEL ${LANG_FRENCH} "Entrez l'URL de connexion PostgreSQL (laissez vide pour utiliser une base locale):" - -LangString MSG_PGURL_REQUIRED ${LANG_ENGLISH} "Please enter a PostgreSQL URL, or leave blank for local DB." -LangString MSG_PGURL_REQUIRED ${LANG_FRENCH} "Veuillez entrer une URL PostgreSQL, ou laissez vide pour une base locale." - -LangString MSG_PGURL_FAILED ${LANG_ENGLISH} "Could not connect to the PostgreSQL database. Please check your URL or leave blank for a local database." -LangString MSG_PGURL_FAILED ${LANG_FRENCH} "Impossible de se connecter à la base PostgreSQL. Vérifiez l'URL ou laissez vide pour une base locale." - -Function DistroPage - nsDialogs::Create 1018 - Pop $0 - ${If} $0 == error - Abort - ${EndIf} - ${NSD_CreateLabel} 0 10u 100% 12u "Choose the WSL Linux distribution to install:" - Pop $0 - ${NSD_CreateRadioButton} 0 30u 100% 12u "Debian" - Pop $RADIO_DEBIAN - ${NSD_CreateRadioButton} 0 45u 100% 12u "Ubuntu" - Pop $RADIO_UBUNTU - ; Debian par défaut sélectionné - ${NSD_SetState} $RADIO_DEBIAN 1 - nsDialogs::Show -FunctionEnd - -Function DistroPageLeave - ${NSD_GetState} $RADIO_DEBIAN $0 - ${If} $0 == 1 - StrCpy $WSL_DISTRO "Debian" - ${EndIf} - ${NSD_GetState} $RADIO_UBUNTU $0 - ${If} $0 == 1 - StrCpy $WSL_DISTRO "Ubuntu" - ${EndIf} - ${If} $WSL_DISTRO == "" - StrCpy $WSL_DISTRO "Debian" - ${EndIf} -FunctionEnd - -Function DomainPage - nsDialogs::Create 1018 - Pop $0 - ${If} $0 == error - Abort - ${EndIf} - ${NSD_CreateLabel} 0 10u 100% 12u $(ENTER_DOMAIN) - Pop $0 - ${NSD_CreateText} 0 25u 100% 12u "" - Pop $DOMAIN_INPUT - nsDialogs::Show -FunctionEnd - -Function DomainPageLeave - ${NSD_GetText} $DOMAIN_INPUT $0 - - ${If} $0 == "" - MessageBox MB_OK|MB_ICONEXCLAMATION $(MSG_DOMAIN_REQUIRED) - Abort - ${EndIf} - - ${If} $0 == "localhost" - MessageBox MB_OK $(MSG_LOCALHOST_WARN) - StrCpy $DOMAIN_INPUT $0 - Return - ${EndIf} - - StrCpy $1 0 - loop_ping: - nsExec::ExecToStack 'ping -n 1 -w 1000 $0' - Pop $2 - ${If} $2 == 0 - StrCpy $DOMAIN_INPUT $0 - Return - ${Else} - Push $0 - MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(MSG_DOMAIN_PING_FAIL)" IDRETRY retry_ping IDCANCEL use_localhost - retry_ping: - IntOp $1 $1 + 1 - ${If} $1 < 3 - Goto loop_ping - ${EndIf} - use_localhost: - StrCpy $DOMAIN_INPUT "localhost" - MessageBox MB_OK $(MSG_LOCALHOST_WARN) - ${EndIf} -FunctionEnd - - -Function ReverseProxyPage - nsDialogs::Create 1018 - Pop $0 - ${If} $0 == error - Abort - ${EndIf} - ${NSD_CreateLabel} 0 10u 100% 12u $(MSG_REVERSE_PROXY_TITLE) - Pop $0 - ${NSD_CreateRadioButton} 0 30u 100% 12u $(MSG_HTTP_ONLY) - Pop $RADIO_HTTP_ONLY - ${NSD_CreateRadioButton} 0 45u 100% 12u $(MSG_HTTPS) - Pop $RADIO_HTTPS - ${NSD_SetState} $RADIO_HTTPS 1 - nsDialogs::Show -FunctionEnd - -Function ReverseProxyPageLeave - ${NSD_GetState} $RADIO_HTTP_ONLY $0 - ${If} $0 == 1 - StrCpy $REVERSE_PROXY_MODE "HTTP" - ${EndIf} - ${NSD_GetState} $RADIO_HTTPS $0 - ${If} $0 == 1 - StrCpy $REVERSE_PROXY_MODE "HTTPS" - ${EndIf} - ${If} $REVERSE_PROXY_MODE == "" - StrCpy $REVERSE_PROXY_MODE "HTTPS" - ${EndIf} -FunctionEnd - -Function PgUrlPage - nsDialogs::Create 1018 - Pop $0 - ${NSD_CreateLabel} 0 10u 100% 12u $(MSG_PGURL_LABEL) - Pop $0 - ${NSD_CreateText} 0 25u 100% 12u "" - Pop $PGURL_INPUT - nsDialogs::Show -FunctionEnd - -Function PgUrlPageLeave - ${NSD_GetText} $PGURL_INPUT $0 - ${If} $0 == "" - ; Si vide, base locale par défaut - StrCpy $PGURL_INPUT "postgresql://taleruser:talerpass@localhost:5432/talerdb" - Return - ${EndIf} - StrCpy $1 0 - loop_pgurl: - nsExec::ExecToStack '"$INSTDIR\test-pgurl.bat" "$0" "$WSL_DISTRO"' - Pop $2 - ${If} $2 == 0 - StrCpy $PGURL_INPUT $0 - Return - ${Else} - MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(MSG_PGURL_FAILED) IDRETRY retry_pgurl IDCANCEL use_local_pg - retry_pgurl: - IntOp $1 $1 + 1 - ${If} $1 < 3 - Goto loop_pgurl - ${EndIf} - use_local_pg: - StrCpy $PGURL_INPUT "postgresql://taleruser:talerpass@localhost:5432/talerdb" - ${EndIf} -FunctionEnd - -Section "Install Taler-Merchant" - SetOutPath "$INSTDIR" - SetDetailsView show - File "setup-pre-wsl.bat" - File "setup-post-wsl.bat" - File "install-taler-from-apt.sh" - File "test-pgurl.bat" - - - FindWindow $0 "#32770" "" $HWNDPARENT - GetDlgItem $HWND_PROGRESS_LABEL $0 1006 - - DetailPrint "---------------------------------------------------------" - DetailPrint "[1/8] Enabling WSL and VirtualMachinePlatform..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 5%" - Sleep 2000 - - MessageBox MB_OK|MB_ICONINFORMATION $(MSG_STEP1) - - DetailPrint "[INFO] This is the slowest step. Please be patient." - DetailPrint "[INFO] Enabling Windows features can take several minutes (up to 5-10 minutes on some computers)." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 8%" - Sleep 5000 - - DetailPrint "[INFO] Do NOT close the installer. The process will continue automatically." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 12%" - Sleep 5000 - - DetailPrint "[INFO] Windows is still enabling the required features..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 16%" - Sleep 5000 - - DetailPrint "[INFO] This is normal. Please wait, your system is working in the background." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 20%" - Sleep 5000 - - ; Etape 1 - setup-pre-wsl (envoie la distro) - nsExec::ExecToLog '"$INSTDIR\setup-pre-wsl.bat" 1 $WSL_DISTRO' - Pop $0 - ${If} $0 != 0 - MessageBox MB_OK $(MSG_NEED_REBOOT) - Quit - ${EndIf} - - MessageBox MB_OK $(MSG_UPDATE_WSL) - - DetailPrint "[2/8] Installing $WSL_DISTRO..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 35%" - nsExec::ExecToLog '"$INSTDIR\setup-pre-wsl.bat" 2 $WSL_DISTRO' - Pop $0 - Sleep 1000 - - DetailPrint "[3/8] Creating $WSL_DISTRO user..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 45%" - nsExec::ExecToLog '"$INSTDIR\setup-pre-wsl.bat" 3 $WSL_DISTRO' - Pop $0 - Sleep 1000 - - DetailPrint "[4/8] Adding user to www-data group..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 55%" - nsExec::ExecToLog '"$INSTDIR\setup-pre-wsl.bat" 4 $WSL_DISTRO' - Pop $0 - Sleep 1000 - - ; --------- TEST PGURL ici, la variable $PGURL_INPUT doit être dispo ---------- - DetailPrint "[TEST] PostgreSQL URL validated." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 58%" - Call PgUrlPage - Call PgUrlPageLeave - Sleep 1000 - - - DetailPrint "[5/8] Copying installer script..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 60%" - nsExec::ExecToLog '"$INSTDIR\setup-post-wsl.bat" 5 $WSL_DISTRO $DOMAIN_INPUT $REVERSE_PROXY_MODE "$PGURL_INPUT"' - Pop $0 - Sleep 1000 - - DetailPrint "[6/8] Converting script format and setting permissions..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 65%" - nsExec::ExecToLog '"$INSTDIR\setup-post-wsl.bat" 6 $WSL_DISTRO $DOMAIN_INPUT $REVERSE_PROXY_MODE "$PGURL_INPUT"' - Pop $0 - Sleep 1000 - - DetailPrint "[7/8] Restarting WSL and launching installation..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 70%" - nsExec::ExecToLog '"$INSTDIR\setup-post-wsl.bat" 7 $WSL_DISTRO $DOMAIN_INPUT $REVERSE_PROXY_MODE "$PGURL_INPUT"' - Pop $0 - Sleep 1000 - - DetailPrint "[8/8] Configuring reverse proxy for $DOMAIN_INPUT in $REVERSE_PROXY_MODE mode..." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 80%" - nsExec::ExecToLog '"$INSTDIR\setup-post-wsl.bat" 8 $WSL_DISTRO $DOMAIN_INPUT $REVERSE_PROXY_MODE "$PGURL_INPUT"' - Pop $0 - Sleep 1000 - - DetailPrint "Testing access to merchant reverse proxy..." - nsExec::ExecToLog 'wsl -d $WSL_DISTRO -- bash -c "curl -v http://localhost"' - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 85%" - Sleep 2000 - - DetailPrint "Checking passed domain in $WSL_DISTRO..." - nsExec::ExecToLog 'wsl -d $WSL_DISTRO -- bash -c "echo Received domain: '\''$DOMAIN_INPUT'\''"' - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 90%" - Sleep 2000 - - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 99%" - Sleep 1000 - DetailPrint "Installation complete." - SendMessage $HWND_PROGRESS_LABEL ${WM_SETTEXT} 0 "STR:Progress: 100%" - - CreateShortCut "$SMPROGRAMS\Taler-Merchant.lnk" "$INSTDIR\taler-installer.exe" -SectionEnd - -Function OpenBrowser - ${If} $REVERSE_PROXY_MODE == "HTTPS" - ExecShell "open" "https://$DOMAIN_INPUT" - ${Else} - ExecShell "open" "http://$DOMAIN_INPUT" - ${EndIf} -FunctionEnd - -Function .onInstFailed - MessageBox MB_OK $(MSG_INSTALL_FAILED) - ExecShell "open" "C:\Users\Public\install.log" -FunctionEnd - - diff --git a/test posgress ext/test-pgurl.bat b/test posgress ext/test-pgurl.bat @@ -1,14 +0,0 @@ -@echo off -REM Usage: test-pgurl.bat <PGURL> <DISTRO> -set PGURL=%1 -set DISTRO=%2 -set WSL=%WINDIR%\Sysnative\wsl.exe - -REM Vérifie que psql existe -%WSL% -d %DISTRO% -- bash -c "command -v psql >/dev/null" || exit /b 2 - -REM Teste la connexion -%WSL% -d %DISTRO% -- bash -c "PGPASSWORD=$(echo '%PGURL%' | sed 's/.*:\/\/[^:]*:\([^@]*\)@.*/\1/') psql '%PGURL%' -c '\q'" 1>NUL 2>NUL - -REM Code de retour 0 si succès, 1 si erreur connexion, 2 si pas de psql -exit /b %ERRORLEVEL%