From 07e3ef46e92c862d052c872f70b5bcfb57363703 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 18 Nov 2026 22:09:05 +0100 Subject: =?UTF-8?q?possibilit=C3=A9=20d'ins=C3=A9rer=20des=20variables=20d?= =?UTF-8?q?ans=20les=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/rustdesk-arch.sh | 15 ----- scripts/rustdesk-arch.sh.php | 15 +++++ scripts/rustdesk-deb.sh | 35 ----------- scripts/rustdesk-deb.sh.php | 35 +++++++++++ scripts/rustdesk-uninstall.bat | 115 --------------------------------- scripts/rustdesk-uninstall.bat.php | 115 +++++++++++++++++++++++++++++++++ scripts/rustdesk.bat | 126 ------------------------------------- scripts/rustdesk.bat.php | 126 +++++++++++++++++++++++++++++++++++++ 8 files changed, 291 insertions(+), 291 deletions(-) delete mode 100755 scripts/rustdesk-arch.sh create mode 100755 scripts/rustdesk-arch.sh.php delete mode 100755 scripts/rustdesk-deb.sh create mode 100755 scripts/rustdesk-deb.sh.php delete mode 100755 scripts/rustdesk-uninstall.bat create mode 100755 scripts/rustdesk-uninstall.bat.php delete mode 100644 scripts/rustdesk.bat create mode 100644 scripts/rustdesk.bat.php (limited to 'scripts') diff --git a/scripts/rustdesk-arch.sh b/scripts/rustdesk-arch.sh deleted file mode 100755 index b7446b5..0000000 --- a/scripts/rustdesk-arch.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# version archlinux - -url=https://remote.ordipolo.fr/client/rustdesk.tar.zst -file=/tmp/rustdesk.tar.zst -config=9JSPNV1NPNWd0ZkSwUDMjRmdUZUSvZFRsZjb5IXNBBjV1VWZOhFZrVHeIN0NSJiOikXZrJCLiIiOikGchJCLiInZu8GbvBXakJ3buUGdv1WZyJiOikXYsVmciwiIyZmLvx2bwlGZy9mLlR3btVmciojI0N3boJye - -if [ ! -f $file ]; then - wget -O $file $url || exit 1 -fi - -sudo pacman -U $file --noconfirm || exit 1 -sudo rustdesk --config $config || exit 1 - -rustdesk & diff --git a/scripts/rustdesk-arch.sh.php b/scripts/rustdesk-arch.sh.php new file mode 100755 index 0000000..b7446b5 --- /dev/null +++ b/scripts/rustdesk-arch.sh.php @@ -0,0 +1,15 @@ +#!/bin/bash +# version archlinux + +url=https://remote.ordipolo.fr/client/rustdesk.tar.zst +file=/tmp/rustdesk.tar.zst +config=9JSPNV1NPNWd0ZkSwUDMjRmdUZUSvZFRsZjb5IXNBBjV1VWZOhFZrVHeIN0NSJiOikXZrJCLiIiOikGchJCLiInZu8GbvBXakJ3buUGdv1WZyJiOikXYsVmciwiIyZmLvx2bwlGZy9mLlR3btVmciojI0N3boJye + +if [ ! -f $file ]; then + wget -O $file $url || exit 1 +fi + +sudo pacman -U $file --noconfirm || exit 1 +sudo rustdesk --config $config || exit 1 + +rustdesk & diff --git a/scripts/rustdesk-deb.sh b/scripts/rustdesk-deb.sh deleted file mode 100755 index 0c03baa..0000000 --- a/scripts/rustdesk-deb.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# version debian - -url=https://remote.ordipolo.fr/client/rustdesk.deb -file=/tmp/rustdesk.deb -config=9JSPNV1NPNWd0ZkSwUDMjRmdUZUSvZFRsZjb5IXNBBjV1VWZOhFZrVHeIN0NSJiOikXZrJCLiIiOikGchJCLiInZu8GbvBXakJ3buUGdv1WZyJiOikXYsVmciwiIyZmLvx2bwlGZy9mLlR3btVmciojI0N3boJye - - -if [ ! -f $file ]; then - wget -O $file $url || exit 1 -fi - - -new_version=$(dpkg-deb -f "$file" Version) -installed_version=$(dpkg-query -W -f='${Version}' rustdesk 2>/dev/null || true) -echo "Version installée : ${installed_version:-aucune}" -echo "Version disponible : $new_version" - -if [ -z "$installed_version" ]; then - echo "RustDesk n'est pas installé. Installation..." - sudo apt install -y "$file" -elif dpkg --compare-versions "$new_version" gt "$installed_version"; then - echo "Nouvelle version détectée. Mise à jour..." - sudo apt install -y "$file" -else - echo "RustDesk est déjà à jour." -fi - - -sudo rustdesk --config $config -mkdir -p ~/.config/rustdesk -sudo cp /root/.config/rustdesk/RustDesk2.toml "$HOME/.config/rustdesk/RustDesk2.toml" -sudo chown "$USER:$USER" "$HOME/.config/rustdesk/RustDesk2.toml" - -rustdesk & diff --git a/scripts/rustdesk-deb.sh.php b/scripts/rustdesk-deb.sh.php new file mode 100755 index 0000000..0c03baa --- /dev/null +++ b/scripts/rustdesk-deb.sh.php @@ -0,0 +1,35 @@ +#!/bin/bash +# version debian + +url=https://remote.ordipolo.fr/client/rustdesk.deb +file=/tmp/rustdesk.deb +config=9JSPNV1NPNWd0ZkSwUDMjRmdUZUSvZFRsZjb5IXNBBjV1VWZOhFZrVHeIN0NSJiOikXZrJCLiIiOikGchJCLiInZu8GbvBXakJ3buUGdv1WZyJiOikXYsVmciwiIyZmLvx2bwlGZy9mLlR3btVmciojI0N3boJye + + +if [ ! -f $file ]; then + wget -O $file $url || exit 1 +fi + + +new_version=$(dpkg-deb -f "$file" Version) +installed_version=$(dpkg-query -W -f='${Version}' rustdesk 2>/dev/null || true) +echo "Version installée : ${installed_version:-aucune}" +echo "Version disponible : $new_version" + +if [ -z "$installed_version" ]; then + echo "RustDesk n'est pas installé. Installation..." + sudo apt install -y "$file" +elif dpkg --compare-versions "$new_version" gt "$installed_version"; then + echo "Nouvelle version détectée. Mise à jour..." + sudo apt install -y "$file" +else + echo "RustDesk est déjà à jour." +fi + + +sudo rustdesk --config $config +mkdir -p ~/.config/rustdesk +sudo cp /root/.config/rustdesk/RustDesk2.toml "$HOME/.config/rustdesk/RustDesk2.toml" +sudo chown "$USER:$USER" "$HOME/.config/rustdesk/RustDesk2.toml" + +rustdesk & diff --git a/scripts/rustdesk-uninstall.bat b/scripts/rustdesk-uninstall.bat deleted file mode 100755 index 89e1584..0000000 --- a/scripts/rustdesk-uninstall.bat +++ /dev/null @@ -1,115 +0,0 @@ -@echo off -setlocal -title Desinstallation de RustDesk - -:: Verifier les droits administrateur et demander l'elevation si necessaire -net session >nul 2>&1 -if %errorlevel% neq 0 ( - echo Demande des droits administrateur... - powershell.exe -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs" - exit /b -) - -cls -echo ========================================== -echo DESINSTALLATION DE RUSTDESK -echo ========================================== -echo. -echo Nettoyage en cours... -echo Veuillez patienter. -echo. - -:: Executer le nettoyage avec PowerShell -powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='SilentlyContinue'; Write-Host '[1/5] Fermeture de RustDesk...'; Get-Process -Name 'rustdesk' | Stop-Process -Force; Start-Sleep -Seconds 2; Write-Host '[2/5] Arret du service...'; $svcs=Get-CimInstance Win32_Service | Where-Object { $_.Name -like '*RustDesk*' -or $_.DisplayName -like '*RustDesk*' }; foreach($s in $svcs) { Stop-Service -Name $s.Name -Force; sc.exe delete $s.Name | Out-Null }; Write-Host '[3/5] Desinstallation du logiciel...'; $keys=@('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'); $apps=Get-ItemProperty $keys | Where-Object { $_.DisplayName -like '*RustDesk*' }; foreach($app in $apps) { if($app.PSChildName -match '^\{[A-Fa-f0-9-]{36}\}$') { Start-Process msiexec.exe -ArgumentList ('/x ' + $app.PSChildName + ' /qn /norestart') -Wait } }; Start-Sleep -Seconds 3; Write-Host '[4/5] Suppression des fichiers et configurations...'; $paths=@('C:\Program Files\RustDesk','C:\Program Files (x86)\RustDesk','C:\ProgramData\RustDesk'); foreach($p in $paths) { if(Test-Path $p) { Remove-Item $p -Recurse -Force } }; $profiles=Get-CimInstance Win32_UserProfile | Where-Object { !$_.Special -and $_.LocalPath -like 'C:\Users\*' }; foreach($profile in $profiles) { foreach($folder in @('AppData\Roaming\RustDesk','AppData\Local\RustDesk')) { $p=Join-Path $profile.LocalPath $folder; if(Test-Path $p) { Remove-Item $p -Recurse -Force } } }; Write-Host '[5/5] Verification et nettoyage final...'; Get-Process -Name 'rustdesk' | Stop-Process -Force; Get-CimInstance Win32_Service | Where-Object { $_.Name -like '*RustDesk*' } | ForEach-Object { sc.exe delete $_.Name | Out-Null }; Write-Host ''; Write-Host 'Nettoyage termine.' -ForegroundColor Green" - -REM powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^ -REM "& { - REM $ErrorActionPreference = 'SilentlyContinue' - - REM Write-Host '[1/5] Fermeture de RustDesk...' - REM Get-Process -Name 'rustdesk' | Stop-Process -Force - REM Start-Sleep -Seconds 2 - - REM Write-Host '[2/5] Arret du service...' - REM $svcs = Get-CimInstance Win32_Service | Where-Object { - REM $_.Name -like '*RustDesk*' -or $_.DisplayName -like '*RustDesk*' - REM } - - REM foreach ($s in $svcs) { - REM Stop-Service -Name $s.Name -Force - REM sc.exe delete $s.Name | Out-Null - REM } - - REM Write-Host '[3/5] Desinstallation du logiciel...' - REM $keys = @( - REM 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', - REM 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' - REM ) - - REM $apps = Get-ItemProperty $keys | Where-Object { - REM $_.DisplayName -like '*RustDesk*' - REM } - - REM foreach ($app in $apps) { - REM if ($app.PSChildName -match '^\{[A-Fa-f0-9-]{36}\}$') { - REM Start-Process msiexec.exe -ArgumentList ( - REM '/x ' + $app.PSChildName + ' /qn /norestart' - REM ) -Wait - REM } - REM } - - REM Start-Sleep -Seconds 3 - - REM Write-Host '[4/5] Suppression des fichiers et configurations...' - REM $paths = @( - REM 'C:\Program Files\RustDesk', - REM 'C:\Program Files (x86)\RustDesk', - REM 'C:\ProgramData\RustDesk' - REM ) - - REM foreach ($p in $paths) { - REM if (Test-Path $p) { - REM Remove-Item $p -Recurse -Force - REM } - REM } - - REM $profiles = Get-CimInstance Win32_UserProfile | Where-Object { - REM !$_.Special -and $_.LocalPath -like 'C:\Users\*' - REM } - - REM foreach ($profile in $profiles) { - REM foreach ($folder in @( - REM 'AppData\Roaming\RustDesk', - REM 'AppData\Local\RustDesk' - REM )) { - REM $p = Join-Path $profile.LocalPath $folder - REM if (Test-Path $p) { - REM Remove-Item $p -Recurse -Force - REM } - REM } - REM } - - REM Write-Host '[5/5] Verification et nettoyage final...' - REM Get-Process -Name 'rustdesk' | Stop-Process -Force - - REM Get-CimInstance Win32_Service | Where-Object { - REM $_.Name -like '*RustDesk*' - REM } | ForEach-Object { - REM sc.exe delete $_.Name | Out-Null - REM } - - REM Write-Host '' - REM Write-Host 'Nettoyage termine.' -ForegroundColor Green -REM }" - -echo. -echo ========================================== -echo OPERATION TERMINEE -echo ========================================== -echo. -echo RustDesk a ete desinstalle et ses fichiers -echo de configuration ont ete supprimes. -echo. -echo Vous pouvez fermer cette fenetre. -echo. -pause \ No newline at end of file diff --git a/scripts/rustdesk-uninstall.bat.php b/scripts/rustdesk-uninstall.bat.php new file mode 100755 index 0000000..89e1584 --- /dev/null +++ b/scripts/rustdesk-uninstall.bat.php @@ -0,0 +1,115 @@ +@echo off +setlocal +title Desinstallation de RustDesk + +:: Verifier les droits administrateur et demander l'elevation si necessaire +net session >nul 2>&1 +if %errorlevel% neq 0 ( + echo Demande des droits administrateur... + powershell.exe -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs" + exit /b +) + +cls +echo ========================================== +echo DESINSTALLATION DE RUSTDESK +echo ========================================== +echo. +echo Nettoyage en cours... +echo Veuillez patienter. +echo. + +:: Executer le nettoyage avec PowerShell +powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='SilentlyContinue'; Write-Host '[1/5] Fermeture de RustDesk...'; Get-Process -Name 'rustdesk' | Stop-Process -Force; Start-Sleep -Seconds 2; Write-Host '[2/5] Arret du service...'; $svcs=Get-CimInstance Win32_Service | Where-Object { $_.Name -like '*RustDesk*' -or $_.DisplayName -like '*RustDesk*' }; foreach($s in $svcs) { Stop-Service -Name $s.Name -Force; sc.exe delete $s.Name | Out-Null }; Write-Host '[3/5] Desinstallation du logiciel...'; $keys=@('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'); $apps=Get-ItemProperty $keys | Where-Object { $_.DisplayName -like '*RustDesk*' }; foreach($app in $apps) { if($app.PSChildName -match '^\{[A-Fa-f0-9-]{36}\}$') { Start-Process msiexec.exe -ArgumentList ('/x ' + $app.PSChildName + ' /qn /norestart') -Wait } }; Start-Sleep -Seconds 3; Write-Host '[4/5] Suppression des fichiers et configurations...'; $paths=@('C:\Program Files\RustDesk','C:\Program Files (x86)\RustDesk','C:\ProgramData\RustDesk'); foreach($p in $paths) { if(Test-Path $p) { Remove-Item $p -Recurse -Force } }; $profiles=Get-CimInstance Win32_UserProfile | Where-Object { !$_.Special -and $_.LocalPath -like 'C:\Users\*' }; foreach($profile in $profiles) { foreach($folder in @('AppData\Roaming\RustDesk','AppData\Local\RustDesk')) { $p=Join-Path $profile.LocalPath $folder; if(Test-Path $p) { Remove-Item $p -Recurse -Force } } }; Write-Host '[5/5] Verification et nettoyage final...'; Get-Process -Name 'rustdesk' | Stop-Process -Force; Get-CimInstance Win32_Service | Where-Object { $_.Name -like '*RustDesk*' } | ForEach-Object { sc.exe delete $_.Name | Out-Null }; Write-Host ''; Write-Host 'Nettoyage termine.' -ForegroundColor Green" + +REM powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^ +REM "& { + REM $ErrorActionPreference = 'SilentlyContinue' + + REM Write-Host '[1/5] Fermeture de RustDesk...' + REM Get-Process -Name 'rustdesk' | Stop-Process -Force + REM Start-Sleep -Seconds 2 + + REM Write-Host '[2/5] Arret du service...' + REM $svcs = Get-CimInstance Win32_Service | Where-Object { + REM $_.Name -like '*RustDesk*' -or $_.DisplayName -like '*RustDesk*' + REM } + + REM foreach ($s in $svcs) { + REM Stop-Service -Name $s.Name -Force + REM sc.exe delete $s.Name | Out-Null + REM } + + REM Write-Host '[3/5] Desinstallation du logiciel...' + REM $keys = @( + REM 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', + REM 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' + REM ) + + REM $apps = Get-ItemProperty $keys | Where-Object { + REM $_.DisplayName -like '*RustDesk*' + REM } + + REM foreach ($app in $apps) { + REM if ($app.PSChildName -match '^\{[A-Fa-f0-9-]{36}\}$') { + REM Start-Process msiexec.exe -ArgumentList ( + REM '/x ' + $app.PSChildName + ' /qn /norestart' + REM ) -Wait + REM } + REM } + + REM Start-Sleep -Seconds 3 + + REM Write-Host '[4/5] Suppression des fichiers et configurations...' + REM $paths = @( + REM 'C:\Program Files\RustDesk', + REM 'C:\Program Files (x86)\RustDesk', + REM 'C:\ProgramData\RustDesk' + REM ) + + REM foreach ($p in $paths) { + REM if (Test-Path $p) { + REM Remove-Item $p -Recurse -Force + REM } + REM } + + REM $profiles = Get-CimInstance Win32_UserProfile | Where-Object { + REM !$_.Special -and $_.LocalPath -like 'C:\Users\*' + REM } + + REM foreach ($profile in $profiles) { + REM foreach ($folder in @( + REM 'AppData\Roaming\RustDesk', + REM 'AppData\Local\RustDesk' + REM )) { + REM $p = Join-Path $profile.LocalPath $folder + REM if (Test-Path $p) { + REM Remove-Item $p -Recurse -Force + REM } + REM } + REM } + + REM Write-Host '[5/5] Verification et nettoyage final...' + REM Get-Process -Name 'rustdesk' | Stop-Process -Force + + REM Get-CimInstance Win32_Service | Where-Object { + REM $_.Name -like '*RustDesk*' + REM } | ForEach-Object { + REM sc.exe delete $_.Name | Out-Null + REM } + + REM Write-Host '' + REM Write-Host 'Nettoyage termine.' -ForegroundColor Green +REM }" + +echo. +echo ========================================== +echo OPERATION TERMINEE +echo ========================================== +echo. +echo RustDesk a ete desinstalle et ses fichiers +echo de configuration ont ete supprimes. +echo. +echo Vous pouvez fermer cette fenetre. +echo. +pause \ No newline at end of file diff --git a/scripts/rustdesk.bat b/scripts/rustdesk.bat deleted file mode 100644 index 5e60787..0000000 --- a/scripts/rustdesk.bat +++ /dev/null @@ -1,126 +0,0 @@ -rem version windows - -@echo off -setlocal - -net session >nul 2>&1 -if %errorlevel% neq 0 ( - echo les droits administrateur sont necessaires - powershell -Command "Start-Process '%~f0' -Verb RunAs" - exit /b -) - -set config=9JSPNV1NPNWd0ZkSwUDMjRmdUZUSvZFRsZjb5IXNBBjV1VWZOhFZrVHeIN0NSJiOikXZrJCLiIiOikGchJCLiInZu8GbvBXakJ3buUGdv1WZyJiOikXYsVmciwiIyZmLvx2bwlGZy9mLlR3btVmciojI0N3boJye - -rem Architecture -if defined PROCESSOR_ARCHITEW6432 ( - set "ARCH=64" -) else if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( - set "ARCH=64" -) else ( - set "ARCH=32" -) -echo Architecture : %ARCH% bits - -rem Version Windows -for /f "tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion 2^>nul') do set "WINVER=%%a" -rem Conversion de 6.1 en 61, 6.2 en 62, etc. -for /f "tokens=1,2 delims=." %%a in ("%WINVER%") do set /a WINVER=%%a*10+%%b -echo Version Windows : %WINVER% - - -rem Windows 7 et anterieurs (seuil 61) -if %WINVER% LEQ 61 ( - echo Ancienne version de Windows detectee - set "URL=https://remote.ordipolo.fr/client/rustdesk-x86.exe" - set "INSTALLER=C:\Temp\rustdesk.exe" - - if "%ARCH%"=="64" ( - set "INSTALL_DIR=C:\Program Files (x86)\RustDesk" - ) else ( - set "INSTALL_DIR=C:\Program Files\RustDesk" - ) -) else ( - echo Windows 8 ou superieur - - if "%ARCH%"=="64" ( - set "URL=https://remote.ordipolo.fr/client/rustdesk-x64.msi" - set "INSTALLER=C:\Temp\rustdesk.msi" - ) else ( - set "URL=https://remote.ordipolo.fr/client/rustdesk-x86.exe" - set "INSTALLER=C:\Temp\rustdesk.exe" - ) - set "INSTALL_DIR=C:\Program Files\RustDesk" -) -echo URL : %URL% -echo Installateur : %INSTALLER% -echo Repertoire : %INSTALL_DIR% - -if not exist "C:\Temp" mkdir "C:\Temp" - -if exist "%INSTALL_DIR%\rustdesk.exe" ( - echo RustDesk est deja installe - "%INSTALL_DIR%\rustdesk.exe" --config "%config%" - timeout /t 2 /nobreak >nul - start "" "%INSTALL_DIR%\rustdesk.exe" - exit /b -) - - -@where curl.exe >nul 2>&1 - -@if %errorlevel%==0 ( - echo Telechargement de RustDesk via cURL - curl.exe -fL -z "%INSTALLER%" -o "%INSTALLER%" "%URL%" || exit /b 1 - -) else ( - if not exist "%INSTALLER%" ( - rem pas de curl dans windows 7, utiliser powershell (nécessite .NET framework 4.8) - echo Telechargement de RustDesk via PowerShell - powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Enum]::ToObject([Net.SecurityProtocolType], 3072); $wc = New-Object Net.WebClient; $wc.DownloadFile('%URL%', '%INSTALLER%')" || exit /b 1 - ) else ( - echo RustDesk deja telecharge - ) -) - - -echo Installation de RustDesk -if "%ARCH%"=="64" if %WINVER% GTR 61 ( - msiexec /i "%INSTALLER%" /qn INSTALLPRINTER=N - goto INSTALL_OK -) - -rem évite de mettre :WAIT_INSTALL dans un bloc if, else, etc -start "" /wait "%INSTALLER%" --silent-install -if errorlevel 1 ( - echo "erreur de l'installation de RustDesk" - exit /b 1 -) - -rem parce que start "" /wait peut ne pas avoir le comportement attendu -set /a COUNT=0 -:WAIT_INSTALL -if exist "%INSTALL_DIR%\rustdesk.exe" ( - echo installation terminee - goto INSTALL_OK -) -set /a COUNT+=1 -if %COUNT% GEQ 60 ( - echo erreur installation non reussie apres 60s - exit /b 1 -) -timeout /t 1 /nobreak >nul -goto WAIT_INSTALL - -:INSTALL_OK - - -echo Installation du service -"%INSTALL_DIR%\rustdesk.exe" --install-service -timeout /t 3 /nobreak >nul - -echo Application de la configuration -"%INSTALL_DIR%\rustdesk.exe" --config "%config%" -timeout /t 2 /nobreak >nul - -start "" "%INSTALL_DIR%\rustdesk.exe" diff --git a/scripts/rustdesk.bat.php b/scripts/rustdesk.bat.php new file mode 100644 index 0000000..5e60787 --- /dev/null +++ b/scripts/rustdesk.bat.php @@ -0,0 +1,126 @@ +rem version windows + +@echo off +setlocal + +net session >nul 2>&1 +if %errorlevel% neq 0 ( + echo les droits administrateur sont necessaires + powershell -Command "Start-Process '%~f0' -Verb RunAs" + exit /b +) + +set config=9JSPNV1NPNWd0ZkSwUDMjRmdUZUSvZFRsZjb5IXNBBjV1VWZOhFZrVHeIN0NSJiOikXZrJCLiIiOikGchJCLiInZu8GbvBXakJ3buUGdv1WZyJiOikXYsVmciwiIyZmLvx2bwlGZy9mLlR3btVmciojI0N3boJye + +rem Architecture +if defined PROCESSOR_ARCHITEW6432 ( + set "ARCH=64" +) else if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( + set "ARCH=64" +) else ( + set "ARCH=32" +) +echo Architecture : %ARCH% bits + +rem Version Windows +for /f "tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion 2^>nul') do set "WINVER=%%a" +rem Conversion de 6.1 en 61, 6.2 en 62, etc. +for /f "tokens=1,2 delims=." %%a in ("%WINVER%") do set /a WINVER=%%a*10+%%b +echo Version Windows : %WINVER% + + +rem Windows 7 et anterieurs (seuil 61) +if %WINVER% LEQ 61 ( + echo Ancienne version de Windows detectee + set "URL=https://remote.ordipolo.fr/client/rustdesk-x86.exe" + set "INSTALLER=C:\Temp\rustdesk.exe" + + if "%ARCH%"=="64" ( + set "INSTALL_DIR=C:\Program Files (x86)\RustDesk" + ) else ( + set "INSTALL_DIR=C:\Program Files\RustDesk" + ) +) else ( + echo Windows 8 ou superieur + + if "%ARCH%"=="64" ( + set "URL=https://remote.ordipolo.fr/client/rustdesk-x64.msi" + set "INSTALLER=C:\Temp\rustdesk.msi" + ) else ( + set "URL=https://remote.ordipolo.fr/client/rustdesk-x86.exe" + set "INSTALLER=C:\Temp\rustdesk.exe" + ) + set "INSTALL_DIR=C:\Program Files\RustDesk" +) +echo URL : %URL% +echo Installateur : %INSTALLER% +echo Repertoire : %INSTALL_DIR% + +if not exist "C:\Temp" mkdir "C:\Temp" + +if exist "%INSTALL_DIR%\rustdesk.exe" ( + echo RustDesk est deja installe + "%INSTALL_DIR%\rustdesk.exe" --config "%config%" + timeout /t 2 /nobreak >nul + start "" "%INSTALL_DIR%\rustdesk.exe" + exit /b +) + + +@where curl.exe >nul 2>&1 + +@if %errorlevel%==0 ( + echo Telechargement de RustDesk via cURL + curl.exe -fL -z "%INSTALLER%" -o "%INSTALLER%" "%URL%" || exit /b 1 + +) else ( + if not exist "%INSTALLER%" ( + rem pas de curl dans windows 7, utiliser powershell (nécessite .NET framework 4.8) + echo Telechargement de RustDesk via PowerShell + powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Enum]::ToObject([Net.SecurityProtocolType], 3072); $wc = New-Object Net.WebClient; $wc.DownloadFile('%URL%', '%INSTALLER%')" || exit /b 1 + ) else ( + echo RustDesk deja telecharge + ) +) + + +echo Installation de RustDesk +if "%ARCH%"=="64" if %WINVER% GTR 61 ( + msiexec /i "%INSTALLER%" /qn INSTALLPRINTER=N + goto INSTALL_OK +) + +rem évite de mettre :WAIT_INSTALL dans un bloc if, else, etc +start "" /wait "%INSTALLER%" --silent-install +if errorlevel 1 ( + echo "erreur de l'installation de RustDesk" + exit /b 1 +) + +rem parce que start "" /wait peut ne pas avoir le comportement attendu +set /a COUNT=0 +:WAIT_INSTALL +if exist "%INSTALL_DIR%\rustdesk.exe" ( + echo installation terminee + goto INSTALL_OK +) +set /a COUNT+=1 +if %COUNT% GEQ 60 ( + echo erreur installation non reussie apres 60s + exit /b 1 +) +timeout /t 1 /nobreak >nul +goto WAIT_INSTALL + +:INSTALL_OK + + +echo Installation du service +"%INSTALL_DIR%\rustdesk.exe" --install-service +timeout /t 3 /nobreak >nul + +echo Application de la configuration +"%INSTALL_DIR%\rustdesk.exe" --config "%config%" +timeout /t 2 /nobreak >nul + +start "" "%INSTALL_DIR%\rustdesk.exe" -- cgit v1.2.3