fixed install for win7-8.1

- fixed installation of the recommended version for win7-8.1 if the -version parameter was used #468
This commit is contained in:
amd64fox
2023-08-02 13:48:44 +03:00
parent cc6e328ff4
commit 02c7fbdaf7
+35 -19
View File
@@ -294,7 +294,7 @@ if ($langCode -eq 'ru') {
} }
Write-Host ($lang).Welcome Write-Host ($lang).Welcome
Write-Host "" Write-Host
# Check version Windows # Check version Windows
$os = Get-CimInstance -ClassName "Win32_OperatingSystem" -ErrorAction SilentlyContinue $os = Get-CimInstance -ClassName "Win32_OperatingSystem" -ErrorAction SilentlyContinue
@@ -322,20 +322,36 @@ if ($version) {
} }
else { else {
Write-Warning "Invalid $($version) format. Example: 1.2.13.661.ga588f749-4064" Write-Warning "Invalid $($version) format. Example: 1.2.13.661.ga588f749-4064"
Write-Host "" Write-Host
} }
} }
$old_os = $win7 -or $win8 -or $win8_1
# Recommended version for Win 7-8.1
$last_win7_full = "1.2.5.1006.g22820f93-1078"
if (!($version -and $version -match $match_v)) { if (!($version -and $version -match $match_v)) {
# Recommended version for Win 7-8.1 if ($old_os) {
if ($win7 -or $win8 -or $win8_1) { $onlineFull = $last_win7_full
$onlineFull = "1.2.5.1006.g22820f93-1078"
} }
# Recommended version for Win 10-12
else { else {
# Recommended version for Win 10-12
$onlineFull = "1.2.17.832.g15fa351e-571" $onlineFull = "1.2.17.832.g15fa351e-571"
} }
} }
else {
if ($old_os) {
$last_win7 = "1.2.5.1006"
if ([version]($onlineFull -split ".g")[0] -gt [version]$last_win7) {
Write-Warning ("Version {0} is only supported on Windows 10 and above" -f ($onlineFull -split ".g")[0])
Write-Warning ("The recommended version has been automatically changed to {0}, the latest supported version for Windows 7-8.1" -f $last_win7)
Write-Host
$onlineFull = $last_win7_full
}
}
}
$online = ($onlineFull -split ".g")[0] $online = ($onlineFull -split ".g")[0]
# Sending a statistical web query to cutt.ly # Sending a statistical web query to cutt.ly
@@ -422,10 +438,10 @@ function downloadSp() {
} }
catch { catch {
Write-Host "" Write-Host
Write-Host ($lang).Download $web_name_file -ForegroundColor RED Write-Host ($lang).Download $web_name_file -ForegroundColor RED
$Error[0].Exception $Error[0].Exception
Write-Host "" Write-Host
Write-Host ($lang).Download2`n Write-Host ($lang).Download2`n
Start-Sleep -Milliseconds 5000 Start-Sleep -Milliseconds 5000
try { try {
@@ -451,7 +467,7 @@ function downloadSp() {
catch { catch {
Write-Host ($lang).Download3 -ForegroundColor RED Write-Host ($lang).Download3 -ForegroundColor RED
$Error[0].Exception $Error[0].Exception
Write-Host "" Write-Host
Write-Host ($lang).Download4`n Write-Host ($lang).Download4`n
($lang).StopScript ($lang).StopScript
$tempDirectory = $PWD $tempDirectory = $PWD
@@ -492,7 +508,7 @@ if ($win10 -or $win11 -or $win8_1 -or $win8 -or $win12) {
if (!($confirm_uninstall_ms_spoti)) { if (!($confirm_uninstall_ms_spoti)) {
do { do {
$ch = Read-Host -Prompt ($lang).MsSpoti2 $ch = Read-Host -Prompt ($lang).MsSpoti2
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
@@ -590,7 +606,7 @@ if ($spotifyInstalled) {
do { do {
Write-Host (($lang).OldV2 -f $offline, $online) Write-Host (($lang).OldV2 -f $offline, $online)
$ch = Read-Host -Prompt ($lang).OldV3 $ch = Read-Host -Prompt ($lang).OldV3
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
@@ -607,7 +623,7 @@ if ($spotifyInstalled) {
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt (($lang).DelOrOver -f $offline) $ch = Read-Host -Prompt (($lang).DelOrOver -f $offline)
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
@@ -668,7 +684,7 @@ if ($spotifyInstalled) {
do { do {
Write-Host (($lang).NewV2 -f $offline, $online) Write-Host (($lang).NewV2 -f $offline, $online)
$ch = Read-Host -Prompt (($lang).NewV3 -f $offline) $ch = Read-Host -Prompt (($lang).NewV3 -f $offline)
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
@@ -681,7 +697,7 @@ if ($spotifyInstalled) {
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt (($lang).Recom -f $online) $ch = Read-Host -Prompt (($lang).Recom -f $online)
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
@@ -698,7 +714,7 @@ if ($spotifyInstalled) {
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt (($lang).DelOrOver -f $offline) $ch = Read-Host -Prompt (($lang).DelOrOver -f $offline)
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
@@ -750,7 +766,7 @@ if (-not $spotifyInstalled -or $upgrade_client) {
# Client download # Client download
downloadSp downloadSp
Write-Host "" Write-Host
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
@@ -792,7 +808,7 @@ if (!($podcasts_off) -and !($podcasts_on)) {
do { do {
$ch = Read-Host -Prompt ($lang).PodcatsSelect $ch = Read-Host -Prompt ($lang).PodcatsSelect
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
@@ -817,7 +833,7 @@ if (!($block_update_on) -and !($block_update_off)) {
do { do {
$text_upd = [string]($lang).UpdSelect + $upd $text_upd = [string]($lang).UpdSelect + $upd
$ch = Read-Host -Prompt $text_upd $ch = Read-Host -Prompt $text_upd
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
@@ -1290,7 +1306,7 @@ if ($test_js) {
do { do {
$ch = Read-Host -Prompt ($lang).Spicetify $ch = Read-Host -Prompt ($lang).Spicetify
Write-Host "" Write-Host
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')