From d2716cd1b753ebbaad2a366b7a42c14a9b7c2fdd Mon Sep 17 00:00:00 2001 From: Aditya Kumar Yadav Date: Thu, 28 May 2026 14:08:59 +0530 Subject: [PATCH 1/5] Enhance install.sh with error handling Added error handling for download, extraction, and permission setting. --- install.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 4d6c1221d1..263e95c01b 100755 --- a/install.sh +++ b/install.sh @@ -75,13 +75,22 @@ tar="$spicetify_install/spicetify.tar.gz" [ ! -d "$spicetify_install" ] && log "CREATING $spicetify_install" && mkdir -p "$spicetify_install" log "DOWNLOADING $download_uri" -curl --fail --location --progress-bar --output "$tar" "$download_uri" +if ! curl --fail --location --progress-bar --output "$tar" "$download_uri"; then + log "ERROR: Failed to download spicetify. Check your internet connection or if the version '$tag' exists." + exit 1 +fi log "EXTRACTING $tar" -tar xzf "$tar" -C "$spicetify_install" +if ! tar xzf "$tar" -C "$spicetify_install"; then + log "ERROR: Failed to extract spicetify. The downloaded file may be corrupted." + exit 1 +fi log "SETTING EXECUTABLE PERMISSIONS TO $exe" -chmod +x "$exe" +if ! chmod +x "$exe"; then + log "ERROR: Failed to set executable permissions on $exe. Try running with correct permissions." + exit 1 +fi log "REMOVING $tar" rm "$tar" From cd1013d1d4f5e5ce033f70f181bf93c1babd7df2 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Yadav Date: Thu, 28 May 2026 14:12:07 +0530 Subject: [PATCH 2/5] Refactor install.ps1 for improved error handling --- install.ps1 | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/install.ps1 b/install.ps1 index d03c8e0e11..4b99c9cba3 100644 --- a/install.ps1 +++ b/install.ps1 @@ -98,8 +98,15 @@ function Get-Spicetify { UseBasicParsin = $true OutFile = $archivePath } - Invoke-WebRequest @Parameters - Write-Success + try { + Invoke-WebRequest @Parameters + Write-Success + } catch { + Write-Unsuccess + Write-Warning "Failed to download spicetify v$targetVersion. Reason: $_" + Pause + exit + } } end { $archivePath @@ -121,9 +128,16 @@ function Add-SpicetifyToPath { } } end { - [Environment]::SetEnvironmentVariable('PATH', $path, $user) - $env:PATH = $path - Write-Success + try { + [Environment]::SetEnvironmentVariable('PATH', $path, $user) + $env:PATH = $path + Write-Success + } catch { + Write-Unsuccess + Write-Warning "Failed to add spicetify to PATH. Reason: $_" + Pause + exit + } } } @@ -136,8 +150,15 @@ function Install-Spicetify { process { $archivePath = Get-Spicetify Write-Host -Object 'Extracting spicetify...' -NoNewline - Expand-Archive -Path $archivePath -DestinationPath $spicetifyFolderPath -Force - Write-Success + try { + Expand-Archive -Path $archivePath -DestinationPath $spicetifyFolderPath -Force + Write-Success + } catch { + Write-Unsuccess + Write-Warning "Failed to extract spicetify. Reason: $_" + Pause + exit + } Add-SpicetifyToPath } end { From af751ebb3959fa8c459631fb24150d2f6febede2 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Yadav Date: Thu, 28 May 2026 14:24:20 +0530 Subject: [PATCH 3/5] Refactor install.ps1 for improved clarity and structure --- install.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.ps1 b/install.ps1 index 4b99c9cba3..2b128b1e6c 100644 --- a/install.ps1 +++ b/install.ps1 @@ -105,7 +105,7 @@ function Get-Spicetify { Write-Unsuccess Write-Warning "Failed to download spicetify v$targetVersion. Reason: $_" Pause - exit + exit 1 } } end { @@ -136,7 +136,7 @@ function Add-SpicetifyToPath { Write-Unsuccess Write-Warning "Failed to add spicetify to PATH. Reason: $_" Pause - exit + exit 1 } } } @@ -157,7 +157,7 @@ function Install-Spicetify { Write-Unsuccess Write-Warning "Failed to extract spicetify. Reason: $_" Pause - exit + exit 1 } Add-SpicetifyToPath } From 0c1906d5d841f93827d3a04b6e208186e7f118df Mon Sep 17 00:00:00 2001 From: Aditya Kumar Yadav Date: Thu, 28 May 2026 14:26:02 +0530 Subject: [PATCH 4/5] Refactor install.ps1 for improved readability --- install.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.ps1 b/install.ps1 index 2b128b1e6c..2695f4cbac 100644 --- a/install.ps1 +++ b/install.ps1 @@ -179,7 +179,7 @@ if (-not (Test-PowerShellVersion)) { Write-Host -Object 'PowerShell 7 install guide:' Write-Host -Object 'https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows' Pause - exit + exit 1 } else { Write-Success @@ -196,7 +196,7 @@ if (-not (Test-Admin)) { if ($choice -eq 0) { Write-Host -Object 'spicetify installation aborted' -ForegroundColor 'Yellow' Pause - exit + exit 1 } } else { From c3b051bf285c8fc29b217c8f0fc825f888fe93ba Mon Sep 17 00:00:00 2001 From: Aditya Kumar Yadav Date: Thu, 28 May 2026 14:27:29 +0530 Subject: [PATCH 5/5] Refactor install.ps1 for improved readability --- install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index 2695f4cbac..dd0b1ce784 100644 --- a/install.ps1 +++ b/install.ps1 @@ -80,7 +80,7 @@ function Get-Spicetify { else { Write-Warning -Message "You have specified an invalid spicetify version: $v `nThe version must be in the following format: 1.2.3" Pause - exit + exit 1 } } else {