Add local rustdesk.exe support and improve installation script
parent
28d0566d74
commit
4ef9247c04
|
|
@ -19,19 +19,27 @@ if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks for the latest version of RustDesk
|
# Проверка наличия rustdesk.exe в текущей папке
|
||||||
$url = 'https://www.github.com//rustdesk/rustdesk/releases/latest'
|
$localRustDesk = Join-Path $PSScriptRoot "rustdesk.exe"
|
||||||
$request = [System.Net.WebRequest]::Create($url)
|
$rustdeskExistsLocally = Test-Path $localRustDesk
|
||||||
$response = $request.GetResponse()
|
|
||||||
$realTagUrl = $response.ResponseUri.OriginalString
|
if (-not $rustdeskExistsLocally) {
|
||||||
$RDLATEST = $realTagUrl.split('/')[-1].Trim('v')
|
# Checks for the latest version of RustDesk
|
||||||
echo "RustDesk $RDLATEST is the latest version."
|
$url = 'https://www.github.com//rustdesk/rustdesk/releases/latest'
|
||||||
|
$request = [System.Net.WebRequest]::Create($url)
|
||||||
|
$response = $request.GetResponse()
|
||||||
|
$realTagUrl = $response.ResponseUri.OriginalString
|
||||||
|
$RDLATEST = $realTagUrl.split('/')[-1].Trim('v')
|
||||||
|
echo "RustDesk $RDLATEST is the latest version."
|
||||||
|
} else {
|
||||||
|
$RDLATEST = "local" # Устанавливаем фиктивную версию для локального файла
|
||||||
|
}
|
||||||
|
|
||||||
# Checks the version of RustDesk installed.
|
# Checks the version of RustDesk installed.
|
||||||
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)
|
$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\" -ErrorAction SilentlyContinue).Version)
|
||||||
|
|
||||||
# Skips to inputting the configuration if the latest version of RustDesk is already installed.
|
# Skips to inputting the configuration if the latest version of RustDesk is already installed.
|
||||||
if ($rdver -eq "$RDLATEST") {
|
if ($rdver -eq $RDLATEST -and -not $rustdeskExistsLocally) {
|
||||||
echo "RustDesk $rdver is already installed."
|
echo "RustDesk $rdver is already installed."
|
||||||
cd $env:ProgramFiles\RustDesk
|
cd $env:ProgramFiles\RustDesk
|
||||||
echo "Inputting configuration now."
|
echo "Inputting configuration now."
|
||||||
|
|
@ -80,6 +88,7 @@ if ($rdver -eq "$RDLATEST") {
|
||||||
echo ""
|
echo ""
|
||||||
echo "..............................................."
|
echo "..............................................."
|
||||||
echo "RustDesk ID: $rustdesk_id"
|
echo "RustDesk ID: $rustdesk_id"
|
||||||
|
echo "Password: $rustdesk_pw"
|
||||||
echo "..............................................."
|
echo "..............................................."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Press Enter to open RustDesk."
|
echo "Press Enter to open RustDesk."
|
||||||
|
|
@ -93,9 +102,16 @@ if (!(Test-Path C:\ProgramData\RustDesk)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cd C:\ProgramData\RustDesk
|
cd C:\ProgramData\RustDesk
|
||||||
echo "Downloading RustDesk version $RDLATEST."
|
|
||||||
powershell Invoke-WebRequest "https://github.com/rustdesk/rustdesk/releases/download/$RDLATEST/rustdesk-$RDLATEST-x86_64.exe" -Outfile "rustdesk.exe"
|
if ($rustdeskExistsLocally) {
|
||||||
echo "Installing RustDesk version $RDLATEST."
|
echo "Found local rustdesk.exe, using it for installation."
|
||||||
|
Copy-Item -Path $localRustDesk -Destination ".\rustdesk.exe" -Force
|
||||||
|
} else {
|
||||||
|
echo "Downloading RustDesk version $RDLATEST."
|
||||||
|
powershell Invoke-WebRequest "https://github.com/rustdesk/rustdesk/releases/download/$RDLATEST/rustdesk-$RDLATEST-x86_64.exe" -Outfile "rustdesk.exe"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Installing RustDesk."
|
||||||
Start-Process .\rustdesk.exe --silent-install
|
Start-Process .\rustdesk.exe --silent-install
|
||||||
Start-Sleep -Seconds 10
|
Start-Sleep -Seconds 10
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue