Skip to content

Commit bbd3ecf

Browse files
committed
OH MY GOD I FIXED IT
1 parent 54d9ea4 commit bbd3ecf

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

install/install_weget.ps1

+18-23
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Script version
2-
$scriptVersion = "v1.5.2"
2+
$scriptVersion = "v1.6"
33
Write-Host "weget installer $scriptVersion" -ForegroundColor Cyan
44

5-
Write-Host "Sorry installer temporarly disabled!"
6-
exit
7-
85
# Define installation paths
96
$userPath = Join-Path $env:APPDATA "KRWCLASSIC\weget"
107
$adminPath = Join-Path ${env:ProgramFiles} "KRWCLASSIC\weget"
@@ -42,7 +39,7 @@ if ([string]::IsNullOrEmpty($installPath)) {
4239
$existingPaths = @($userPath, $adminPath) | Where-Object { Test-Path (Join-Path $_ "weget.exe") }
4340
if ($existingPaths) {
4441
Write-Host "weget is already installed at: $($existingPaths -join ', ')" -ForegroundColor Yellow
45-
$installPath = $existingPaths[0] # Use the first found path
42+
$installPath = $existingPaths
4643
} else {
4744
# Create directory if it does not exist
4845
if (!(Test-Path $installPath)) {
@@ -56,26 +53,24 @@ $wegetExePath = Join-Path $installPath "weget.exe"
5653
Write-Host "Expected weget.exe path: $wegetExePath" -ForegroundColor Magenta
5754
if (Test-Path $wegetExePath) {
5855
Write-Host "Verifying existing installation..." -ForegroundColor Cyan
56+
}
57+
58+
# Verify existing installation
59+
if (Test-Path $wegetExePath) {
5960
try {
60-
$version = & $wegetExePath --version 2>&1
61-
if ($LASTEXITCODE -eq 0) {
62-
$existingHash = Get-FileHashValue $wegetExePath
63-
$latestUrl = "https://raw.githubusercontent.com/KRWCLASSIC/weget/refs/heads/main/install/latest_release.txt"
64-
$binaryUrl = Invoke-WebRequest -Uri $latestUrl -UseBasicParsing | Select-Object -ExpandProperty Content
65-
$tempExeDestination = Join-Path $installPath "weget_temp.exe"
66-
Invoke-WebRequest -Uri $binaryUrl -OutFile $tempExeDestination -ErrorAction Stop
67-
$newHash = Get-FileHashValue $tempExeDestination
68-
if ($existingHash -ne $newHash) {
69-
Write-Host "New version detected. Updating weget..." -ForegroundColor Green
70-
Move-Item -Path $tempExeDestination -Destination $wegetExePath -Force
71-
} else {
72-
Write-Host "Existing installation is up to date." -ForegroundColor Green
73-
Remove-Item $tempExeDestination -Force
74-
exit 0
75-
}
61+
$existingHash = Get-FileHashValue $wegetExePath
62+
$latestUrl = "https://raw.githubusercontent.com/KRWCLASSIC/weget/refs/heads/main/install/latest_release.txt"
63+
$binaryUrl = Invoke-WebRequest -Uri $latestUrl -UseBasicParsing | Select-Object -ExpandProperty Content
64+
$tempExeDestination = Join-Path $installPath "weget_temp.exe"
65+
Invoke-WebRequest -Uri $binaryUrl -OutFile $tempExeDestination -ErrorAction Stop
66+
$newHash = Get-FileHashValue $tempExeDestination
67+
if ($existingHash -ne $newHash) {
68+
Write-Host "New version detected. Updating weget..." -ForegroundColor Green
69+
Move-Item -Path $tempExeDestination -Destination $wegetExePath -Force
7670
} else {
77-
Write-Host "Existing installation verification failed" -ForegroundColor Red
78-
exit 1
71+
Write-Host "Existing installation is up to date." -ForegroundColor Green
72+
Remove-Item $tempExeDestination -Force
73+
exit 0
7974
}
8075
} catch {
8176
Write-Host "Failed to verify existing installation: $_" -ForegroundColor Red

readme.md

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ iwr weget.krwclassic.com | iex
2626

2727
to fix (installer):
2828

29-
- THE "C"
3029
- add antivirus exception? its getting ridiculus now bro
3130

3231
## Building

0 commit comments

Comments
 (0)