From 371bda6aa0a662b85004bc75b6674b12f10b6425 Mon Sep 17 00:00:00 2001 From: Grigory Date: Thu, 16 Nov 2023 02:01:53 +0500 Subject: [PATCH 01/14] refactor(install/windows): rewrite script --- install.ps1 | 394 +++++++++++++++++++++++++++++----------------------- 1 file changed, 217 insertions(+), 177 deletions(-) diff --git a/install.ps1 b/install.ps1 index 7a5e9136d8..1364b92a93 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,177 +1,217 @@ -# Copyright 2023 Spicetify. GPL license. -# Edited from project Denoland install script (https://github.com/denoland/deno_install) -param ( - [string] $version -) - -$PSMinVersion = 3 - -if ($v) { - $version = $v -} - -#region Functions -function Write-Emphasized { - param ( - [Parameter(Mandatory)] - [string] $Text - ) - - Write-Host -Object $Text -NoNewline -ForegroundColor "Cyan" -} - -function Write-Log { - param ( - [string] $ActionText, - [string[]] $Texts, - [boolean[]] $Emphasized - ) - - if (-not (Test-Path -Path $logFileDir)) { - New-Item -Path $logFileDir -ItemType File -Force | Out-Null - } - - if (-not ($ActionText)) { - $FormattedActionText = "{0, -15}" -f $ActionText - Write-Host -Object $FormattedActionText -NoNewline - } - - $logText = $FormattedActionText - - for ($i = 0; $i -lt $Texts.Length -and $Texts.Length -eq $Emphasized.Length; $i++) { - if ($Emphasized.Get($i)) { - Write-Host -Object $Texts.Get($i) -NoNewline - } - else { - Write-Host -Object $Texts.Get($i) -NoNewline - } - $logText = $LogText + $Texts.Get($i) - } - $logText = "[{0}] {1}" -f (Get-Date -Format "HH:mm:ss yyyy-MM-dd"), $LogText - Add-Content -Path $logFileDir -Value $LogText -NoNewline -} - -function Write-Done { - Write-Host -Object " > " -NoNewline - Write-Host -Object "OK" -ForegroundColor "Green" - Add-Content -Path $logFileDir -Value " > OK" -} - -function Remove-OldPath { - $spicetifyOldDir = "${HOME}\spicetify-cli" - $_isInPath = $paths -contains $spicetifyOldDir -or $paths -contains "${spicetifyOldDir}\" - - if ($_isInPath) { - Write-Log -ActionText "REMOVING" -Texts $spicetifyOldDir, " from Path" -Emphasized $true, $false - $replacedPath = $path.replace(";$spicetifyOldDir", "") - [Environment]::SetEnvironmentVariable("PATH", $replacedPath, $user) - $env:PATH = $env:PATH.replace(";$spicetifyOldDir", "") - Write-Done - } -} - -function Move-ConfigFolder { - $spicetifyOldDirContent = "${HOME}\spicetify-cli\*" - $spicetifyOldDir = "${HOME}\spicetify-cli" - if (Test-Path -Path $spicetifyOldDir) { - Write-Log -ActionText "MIGRATING" -Texts $spicetifyOldDir, " into", $spicetifyDir -Emphasized $true, $false, $true - Copy-Item -Path $spicetifyOldDirContent -Destination $spicetifyDir -Force -Recurse - Write-Done - Write-Log -ActionText "REMOVING" -Texts $spicetifyOldDir -Emphasized $true - Remove-Item -LiteralPath $spicetifyOldDir -Force -Recurse - Write-Done - } -} -#endregion Functions - -#region Main -if ($PSVersionTable.PSVersion.Major -ge $PSMinVersion) { - $ErrorActionPreference = "Stop" - - # Enable TLS 1.2 since it is required for connections to GitHub. - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - - # Create %localappdata%\spicetify directory if it doesn't already exist - $spicetifyDir = "$env:LOCALAPPDATA\spicetify" - $logFileDir = "$spicetifyDir\install.log" - - $currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) - $isAdmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) - - if ($isAdmin) { - Write-Log -ActionText "WARNING" -Texts "The script was ran as Administrator which isn't recommended`n" -Emphasized $false - $Host.UI.RawUI.Flushinputbuffer() - $choice = $Host.UI.PromptForChoice("", "Do you want to abort the installation process to avoid any issues?", ("&Yes", "&No"), 0) - if ($choice -eq 0) { - Write-Log -ActionText "WARNING" -Texts "Exiting the script..." -Emphasized $false - exit - } - } - - if (-not (Test-Path -Path $spicetifyDir)) { - Write-Log -ActionText "MAKING FOLDER" -Texts $spicetifyDir -Emphasized $true - Write-Done - } - - if (-not $version) { - # Determine latest Spicetify release via GitHub API. - $latestReleaseUri = "https://api.github.com/repos/spicetify/spicetify-cli/releases/latest" - Write-Log -ActionText "DOWNLOADING" -Texts $latestReleaseUri -Emphasized $true - $latestReleaseJson = Invoke-WebRequest -Uri $latestReleaseUri -UseBasicParsing - Write-Done - $version = ($latestReleaseJson | ConvertFrom-Json).tag_name -replace "v", "" - } - - # Migrate old spicetify folder to new location. - Move-ConfigFolder - - # Download release. - $architecture = if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") { "x64" } else { "x32" } - $zipFile = "${spicetifyDir}\spicetify-${version}-windows-${architecture}.zip" - $downloadUri = "https://github.com/spicetify/spicetify-cli/releases/download/" + - "v${version}/spicetify-${version}-windows-${architecture}.zip" - Write-Log -ActionText "DOWNLOADING" -Texts $downloadUri -Emphasized $true - Invoke-WebRequest -Uri $downloadUri -UseBasicParsing -OutFile $zipFile - Write-Done - - # Extract spicetify.exe and assets from .zip file. - Write-Log -ActionText "EXTRACTING" -Texts $zipFile, " into ", ${spicetifyDir} -Emphasized $true, $false, $true - # Using -Force to overwrite spicetify.exe and assets if it already exists - Expand-Archive -Path $zipFile -DestinationPath $spicetifyDir -Force - Write-Done - - # Remove .zip file. - Write-Log -ActionText "REMOVING" -Texts $zipFile -Emphasized $true - Remove-Item -Path $zipFile - Write-Done - - # Get Path environment variable for the current user. - $user = [EnvironmentVariableTarget]::User - $path = [Environment]::GetEnvironmentVariable("PATH", $user) - - # Check whether spicetify dir is in the Path. - $paths = $path -split ";" - - # Remove old spicetify folder from Path. - Remove-OldPath - $isInPath = $paths -contains $spicetifyDir -or $paths -contains "${spicetifyDir}\" - - # Add Spicetify dir to PATH if it hasn't been added already. - if (-not $isInPath) { - Write-Log -ActionText "ADDING" -Texts $spicetifyDir, " to the ", "PATH", " environment variable..." -Emphasized $true, $false, $true, $false - [Environment]::SetEnvironmentVariable("PATH", "${path};${spicetifyDir}", $user) - # Add Spicetify to the PATH variable of the current terminal session - # so `spicetify` can be used immediately without restarting the terminal. - $env:PATH += ";${spicetifyDir}" - Write-Done - } - - Write-Log -Texts "spicetify-cli was installed successfully." -Emphasized $false - Write-Done - Write-Log -Texts "Run ", "spicetify --help", " to get started.`n" -Emphasized $false, $true, $false -} -else { - Write-Log -Texts "`nYour Powershell version is lesser than ", "$PSMinVersion" -Emphasized $false, $true - Write-Log -Texts "`nPlease, update your Powershell downloading the ", "'Windows Management Framework'", " greater than ", "$PSMinVersion" -Emphasized $false, $true, $false, $true -} -#endregion Main +$ErrorActionPreference = 'Stop' +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +#region Variables +$spicetifyFolderPath = "$env:LOCALAPPDATA\spicetify" +$spicetifyOldFolderPath = "$HOME\spicetify-cli" +$logFilePath = "$spicetifyFolderPath\install.log" +#endregion Variables + +#region Functions +function Write-Log { + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + [string]$Message, + + [ValidateSet('Error', 'Warning', 'Information', 'Verbose', 'Debug')] + [string]$Stream = 'Information', + + [System.ConsoleColor]$ForegroundColor = $Host.UI.RawUI.ForegroundColor, + + [System.ConsoleColor]$BackgroundColor = $Host.UI.RawUI.BackgroundColor + ) + begin { + if (-not (Test-Path -Path $logFilePath)) { + New-Item -Path $logFilePath -ItemType 'File' -Force + } + } + process { + Add-Content -Path $logFilePath -Value "[$(Get-Date -Format 'HH:mm:ss yyyy-MM-dd')] $($Stream): $Message" + switch -exact ($Stream) { + 'Error' { + Write-Error -Message $Message + } + 'Warning' { + Write-Warning -Message $Message + } + 'Information' { + Write-Host -Object $Message -ForegroundColor $ForegroundColor -BackgroundColor $BackgroundColor + } + 'Verbose' { + Write-Verbose -Message $Message -Verbose + } + 'Debug' { + Write-Debug -Message $Message -Debug + } + } + } +} + +function Write-Success { + [CmdletBinding()] + param () + process { + Write-Log -Message 'Success' -ForegroundColor 'Green' + } +} + +function Test-Admin { + [CmdletBinding()] + param () + begin { + Write-Log -Message 'Checking if the script was ran as Administrator...' -Stream 'Verbose' + } + process { + $currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) + $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) + } +} + +function Test-PowerShellVersion { + [CmdletBinding()] + param () + begin { + $PSMinVersion = [version]'5.1' + } + process { + Write-Log -Message 'Checking your PowerShell version...' -Stream 'Verbose' + $PSVersionTable.PSVersion -lt $PSMinVersion + } +} + +function Move-OldSpicetifyFolder { + [CmdletBinding()] + param () + process { + if (Test-Path -Path $spicetifyOldFolderPath) { + Write-Log -Message 'Moving your old Spicetify folder...' -Stream 'Verbose' + Copy-Item -Path "$spicetifyOldFolderPath\*" -Destination $spicetifyFolderPath -Recurse -Force + Remove-Item -Path $spicetifyOldFolderPath -Recurse -Force + Write-Success + } + } +} + +function Get-Spicetify { + [CmdletBinding()] + param () + begin { + if ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64') { + $architecture = 'x64' + } + else { + $architecture = 'x32' + } + if ($v -match '^\d+\.\d+\.\d+$') { + $targetVersion = $v + } + else { + Write-Log -Message 'Fetching the latest Spicetify version...' -Stream 'Verbose' + $latestRelease = Invoke-RestMethod -Uri 'https://api.github.com/repos/spicetify/spicetify-cli/releases/latest' + $targetVersion = $latestRelease.tag_name -replace 'v', '' + Write-Success + } + $archivePath = "$env:TEMP\spicetify.zip" + } + process { + Write-Log -Message "Downloading Spicetify v$targetVersion..." -Stream 'Verbose' + $Parameters = @{ + Uri = "https://github.com/spicetify/spicetify-cli/releases/download/v$targetVersion/spicetify-$targetVersion-windows-$architecture.zip" + UseBasicParsin = $true + OutFile = $archivePath + } + Invoke-WebRequest @Parameters + Write-Success + } + end { + $archivePath + } +} + +function Add-SpicetifyToPath { + [CmdletBinding()] + param () + begin { + Write-Log -Message 'Adding Spicetify to your PATH variable if needed...' -Stream 'Verbose' + $user = [EnvironmentVariableTarget]::User + $path = [Environment]::GetEnvironmentVariable('PATH', $user) + } + process { + $path = $path -replace "$([regex]::Escape($spicetifyOldFolderPath))\\*;*", '' + if ($path -notlike "*$spicetifyFolderPath*") { + $path = "$path;$spicetifyFolderPath" + } + } + end { + [Environment]::SetEnvironmentVariable('PATH', $path, $user) + Write-Success + } +} + +function Install-Spicetify { + [CmdletBinding()] + param () + begin { + Write-Log -Message 'Installing Spicetify...' -Stream 'Verbose' + } + process { + $archivePath = Get-Spicetify + Write-Log -Message 'Extracting Spicetify...' -Stream 'Verbose' + Expand-Archive -Path $archivePath -DestinationPath $spicetifyFolderPath -Force + Write-Success + Add-SpicetifyToPath + } + end { + Remove-Item -Path $archivePath -Force + Write-Log -Message 'Spicetify was successfully installed' -ForegroundColor 'Green' + } +} +#endregion Functions + +#region Main +Remove-Item -Path $logFilePath -Force + +#region Checks +if (-not (Test-PowerShellVersion)) { + Write-Log -Message 'PowerShell 5.1 or higher is required to run this script' -Stream 'Warning' + Write-Log -Message "You are running PowerShell $($PSVersionTable.PSVersion)" -Stream 'Warning' + Write-Host -Object 'PowerShell 5.1 install guide:' + Write-Host -Object 'https://learn.microsoft.com/skypeforbusiness/set-up-your-computer-for-windows-powershell/download-and-install-windows-powershell-5-1' + Write-Host -Object 'PowerShell 7 install guide:' + Write-Host -Object 'https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows' + Pause + exit +} +if (Test-Admin) { + Write-Log -Message "The script was ran as Administrator which isn't recommended" -Stream 'Warning' + $Host.UI.RawUI.Flushinputbuffer() + $choice = $Host.UI.PromptForChoice('', 'Do you want to abort the installation process to avoid any issues?', ('&Yes', '&No'), 0) + if ($choice -eq 0) { + Write-Log -Message 'Spicetify installation aborted' + exit + } +} +#endregion Checks + +#region Spicetify +Move-OldSpicetifyFolder +Install-Spicetify +Write-Host -Object 'Run spicetify -h to get started' +#endregion Spicetify + +#region Marketplace +$Host.UI.RawUI.Flushinputbuffer() +$choice = $Host.UI.PromptForChoice('', 'Do you want to install Spicetify Marketplace?', ('&Yes', '&No'), 0) +if ($choice -eq 1) { + Write-Log -Message 'Spicetify Marketplace installation aborted' + exit +} +Write-Log -Message 'Starting the Spicetify Marketplace installation script..' -Stream 'Verbose' +$Parameters = @{ + Uri = 'https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1' + UseBasicParsing = $true +} +Invoke-WebRequest @Parameters | Invoke-Expression +#endregion Marketplace +#endregion Main From 1fe0ffb4483be27b7a33c3bdb48a4e3813a05f71 Mon Sep 17 00:00:00 2001 From: Grigory Date: Thu, 16 Nov 2023 02:44:12 +0500 Subject: [PATCH 02/14] remove debug option from write-log --- install.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/install.ps1 b/install.ps1 index 1364b92a93..f5972fea1f 100644 --- a/install.ps1 +++ b/install.ps1 @@ -14,7 +14,7 @@ function Write-Log { [Parameter(Mandatory)] [string]$Message, - [ValidateSet('Error', 'Warning', 'Information', 'Verbose', 'Debug')] + [ValidateSet('Error', 'Warning', 'Information', 'Verbose')] [string]$Stream = 'Information', [System.ConsoleColor]$ForegroundColor = $Host.UI.RawUI.ForegroundColor, @@ -41,9 +41,6 @@ function Write-Log { 'Verbose' { Write-Verbose -Message $Message -Verbose } - 'Debug' { - Write-Debug -Message $Message -Debug - } } } } From e29948473b7e5413346047065f2f4210dd87d592 Mon Sep 17 00:00:00 2001 From: Grigory Date: Thu, 16 Nov 2023 13:28:56 +0500 Subject: [PATCH 03/14] show a warning if spicefied spicetify version is invalid --- install.ps1 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/install.ps1 b/install.ps1 index f5972fea1f..4a9fb54bc7 100644 --- a/install.ps1 +++ b/install.ps1 @@ -100,8 +100,16 @@ function Get-Spicetify { else { $architecture = 'x32' } - if ($v -match '^\d+\.\d+\.\d+$') { - $targetVersion = $v + if ($v) { + if ($v -match '^\d+\.\d+\.\d+$') { + $targetVersion = $v + } + else { + Write-Log -Message "You have spicefied an invalid Spicetify version: $v" -Stream 'Warning' + Write-Host -Object 'The version must be in the following format: 1.2.3' + Pause + exit + } } else { Write-Log -Message 'Fetching the latest Spicetify version...' -Stream 'Verbose' From e64155698daaba1edec72bf129b61065ddbc55c6 Mon Sep 17 00:00:00 2001 From: Grigory Date: Thu, 16 Nov 2023 13:39:01 +0500 Subject: [PATCH 04/14] remove logging --- install.ps1 | 74 ++++++++++++----------------------------------------- 1 file changed, 17 insertions(+), 57 deletions(-) diff --git a/install.ps1 b/install.ps1 index 4a9fb54bc7..234867d310 100644 --- a/install.ps1 +++ b/install.ps1 @@ -4,52 +4,14 @@ $ErrorActionPreference = 'Stop' #region Variables $spicetifyFolderPath = "$env:LOCALAPPDATA\spicetify" $spicetifyOldFolderPath = "$HOME\spicetify-cli" -$logFilePath = "$spicetifyFolderPath\install.log" #endregion Variables #region Functions -function Write-Log { - [CmdletBinding()] - param ( - [Parameter(Mandatory)] - [string]$Message, - - [ValidateSet('Error', 'Warning', 'Information', 'Verbose')] - [string]$Stream = 'Information', - - [System.ConsoleColor]$ForegroundColor = $Host.UI.RawUI.ForegroundColor, - - [System.ConsoleColor]$BackgroundColor = $Host.UI.RawUI.BackgroundColor - ) - begin { - if (-not (Test-Path -Path $logFilePath)) { - New-Item -Path $logFilePath -ItemType 'File' -Force - } - } - process { - Add-Content -Path $logFilePath -Value "[$(Get-Date -Format 'HH:mm:ss yyyy-MM-dd')] $($Stream): $Message" - switch -exact ($Stream) { - 'Error' { - Write-Error -Message $Message - } - 'Warning' { - Write-Warning -Message $Message - } - 'Information' { - Write-Host -Object $Message -ForegroundColor $ForegroundColor -BackgroundColor $BackgroundColor - } - 'Verbose' { - Write-Verbose -Message $Message -Verbose - } - } - } -} - function Write-Success { [CmdletBinding()] param () process { - Write-Log -Message 'Success' -ForegroundColor 'Green' + Write-Host -Object 'Success' -ForegroundColor 'Green' } } @@ -57,7 +19,7 @@ function Test-Admin { [CmdletBinding()] param () begin { - Write-Log -Message 'Checking if the script was ran as Administrator...' -Stream 'Verbose' + Write-Verbose -Message 'Checking if the script was ran as Administrator...' -Verbose } process { $currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) @@ -72,7 +34,7 @@ function Test-PowerShellVersion { $PSMinVersion = [version]'5.1' } process { - Write-Log -Message 'Checking your PowerShell version...' -Stream 'Verbose' + Write-Verbose -Message 'Checking your PowerShell version...' -Verbose $PSVersionTable.PSVersion -lt $PSMinVersion } } @@ -82,7 +44,7 @@ function Move-OldSpicetifyFolder { param () process { if (Test-Path -Path $spicetifyOldFolderPath) { - Write-Log -Message 'Moving your old Spicetify folder...' -Stream 'Verbose' + Write-Verbose -Message 'Moving your old Spicetify folder...' -Verbose Copy-Item -Path "$spicetifyOldFolderPath\*" -Destination $spicetifyFolderPath -Recurse -Force Remove-Item -Path $spicetifyOldFolderPath -Recurse -Force Write-Success @@ -105,14 +67,14 @@ function Get-Spicetify { $targetVersion = $v } else { - Write-Log -Message "You have spicefied an invalid Spicetify version: $v" -Stream 'Warning' + Write-Warning -Message "You have spicefied an invalid Spicetify version: $v" Write-Host -Object 'The version must be in the following format: 1.2.3' Pause exit } } else { - Write-Log -Message 'Fetching the latest Spicetify version...' -Stream 'Verbose' + Write-Verbose -Message 'Fetching the latest Spicetify version...' -Verbose $latestRelease = Invoke-RestMethod -Uri 'https://api.github.com/repos/spicetify/spicetify-cli/releases/latest' $targetVersion = $latestRelease.tag_name -replace 'v', '' Write-Success @@ -120,7 +82,7 @@ function Get-Spicetify { $archivePath = "$env:TEMP\spicetify.zip" } process { - Write-Log -Message "Downloading Spicetify v$targetVersion..." -Stream 'Verbose' + Write-Verbose -Message "Downloading Spicetify v$targetVersion..." -Verbose $Parameters = @{ Uri = "https://github.com/spicetify/spicetify-cli/releases/download/v$targetVersion/spicetify-$targetVersion-windows-$architecture.zip" UseBasicParsin = $true @@ -138,7 +100,7 @@ function Add-SpicetifyToPath { [CmdletBinding()] param () begin { - Write-Log -Message 'Adding Spicetify to your PATH variable if needed...' -Stream 'Verbose' + Write-Verbose -Message 'Adding Spicetify to your PATH variable if needed...' -Verbose $user = [EnvironmentVariableTarget]::User $path = [Environment]::GetEnvironmentVariable('PATH', $user) } @@ -158,29 +120,27 @@ function Install-Spicetify { [CmdletBinding()] param () begin { - Write-Log -Message 'Installing Spicetify...' -Stream 'Verbose' + Write-Verbose -Message 'Installing Spicetify...' -Verbose } process { $archivePath = Get-Spicetify - Write-Log -Message 'Extracting Spicetify...' -Stream 'Verbose' + Write-Verbose -Message 'Extracting Spicetify...' -Verbose Expand-Archive -Path $archivePath -DestinationPath $spicetifyFolderPath -Force Write-Success Add-SpicetifyToPath } end { Remove-Item -Path $archivePath -Force - Write-Log -Message 'Spicetify was successfully installed' -ForegroundColor 'Green' + Write-Host -Object 'Spicetify was successfully installed' -ForegroundColor 'Green' } } #endregion Functions #region Main -Remove-Item -Path $logFilePath -Force - #region Checks if (-not (Test-PowerShellVersion)) { - Write-Log -Message 'PowerShell 5.1 or higher is required to run this script' -Stream 'Warning' - Write-Log -Message "You are running PowerShell $($PSVersionTable.PSVersion)" -Stream 'Warning' + Write-Warning -Message 'PowerShell 5.1 or higher is required to run this script' + Write-Warning -Message "You are running PowerShell $($PSVersionTable.PSVersion)" Write-Host -Object 'PowerShell 5.1 install guide:' Write-Host -Object 'https://learn.microsoft.com/skypeforbusiness/set-up-your-computer-for-windows-powershell/download-and-install-windows-powershell-5-1' Write-Host -Object 'PowerShell 7 install guide:' @@ -189,11 +149,11 @@ if (-not (Test-PowerShellVersion)) { exit } if (Test-Admin) { - Write-Log -Message "The script was ran as Administrator which isn't recommended" -Stream 'Warning' + Write-Warning -Message "The script was ran as Administrator which isn't recommended" $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', 'Do you want to abort the installation process to avoid any issues?', ('&Yes', '&No'), 0) if ($choice -eq 0) { - Write-Log -Message 'Spicetify installation aborted' + Write-Host -Object 'Spicetify installation aborted' exit } } @@ -209,10 +169,10 @@ Write-Host -Object 'Run spicetify -h to get started' $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', 'Do you want to install Spicetify Marketplace?', ('&Yes', '&No'), 0) if ($choice -eq 1) { - Write-Log -Message 'Spicetify Marketplace installation aborted' + Write-Host -Object 'Spicetify Marketplace installation aborted' exit } -Write-Log -Message 'Starting the Spicetify Marketplace installation script..' -Stream 'Verbose' +Write-Verbose -Message 'Starting the Spicetify Marketplace installation script..' -Verbose $Parameters = @{ Uri = 'https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1' UseBasicParsing = $true From cf12858a3692eb8dce702eb8f420485855fedbeb Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 5 Dec 2023 16:56:52 +0500 Subject: [PATCH 05/14] Update install.sh --- install.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/install.sh b/install.sh index 1afb9ec1c0..3e23e9f9c6 100755 --- a/install.sh +++ b/install.sh @@ -135,3 +135,12 @@ esac echo log "spicetify v$tag was installed successfully to $spicetify_install" log "Run 'spicetify --help' to get started" + +read -p "Do you want to install Spicetify Marketplace? (y/N) " choice +if [[ $choice == [Yy]* ]]; then + echo "Starting the Spicetify Marketplace installation script.." + curl -fsSL "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.sh" | sh +else + echo "Spicetify Marketplace installation aborted" + exit +fi From fc3fe5269282f880dc0a2aa7cbf746016a5c9cea Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 5 Dec 2023 17:16:47 +0500 Subject: [PATCH 06/14] fix checking psversion --- install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index 234867d310..fdc05f6118 100644 --- a/install.ps1 +++ b/install.ps1 @@ -35,7 +35,7 @@ function Test-PowerShellVersion { } process { Write-Verbose -Message 'Checking your PowerShell version...' -Verbose - $PSVersionTable.PSVersion -lt $PSMinVersion + $PSVersionTable.PSVersion -ge $PSMinVersion } } From edad32c513ca4e3f7faf9c453b879d7dd33280ec Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 5 Dec 2023 17:19:22 +0500 Subject: [PATCH 07/14] shell script: change the default choice --- install.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 3e23e9f9c6..96e25b9730 100755 --- a/install.sh +++ b/install.sh @@ -136,11 +136,10 @@ echo log "spicetify v$tag was installed successfully to $spicetify_install" log "Run 'spicetify --help' to get started" -read -p "Do you want to install Spicetify Marketplace? (y/N) " choice -if [[ $choice == [Yy]* ]]; then - echo "Starting the Spicetify Marketplace installation script.." - curl -fsSL "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.sh" | sh -else +read -p "Do you want to install Spicetify Marketplace? (Y/n) " choice +if [[ $choice == [Nn]* ]]; then echo "Spicetify Marketplace installation aborted" exit fi +echo "Starting the Spicetify Marketplace installation script.." +curl -fsSL "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.sh" | sh From 8cea02932dccfeb66421c252b83910b8c94851e0 Mon Sep 17 00:00:00 2001 From: Grigory Date: Sun, 10 Dec 2023 23:17:18 +0500 Subject: [PATCH 08/14] fix(install/windows): add spicetify to $env path --- install.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/install.ps1 b/install.ps1 index fdc05f6118..4c16547e46 100644 --- a/install.ps1 +++ b/install.ps1 @@ -112,6 +112,7 @@ function Add-SpicetifyToPath { } end { [Environment]::SetEnvironmentVariable('PATH', $path, $user) + $env:PATH = $path Write-Success } } From fe70133bb6be556cba6c7d9a4886257e2f29344b Mon Sep 17 00:00:00 2001 From: Grigory Date: Sun, 10 Dec 2023 23:26:01 +0500 Subject: [PATCH 09/14] install/windows: remove exit --- install.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/install.ps1 b/install.ps1 index 4c16547e46..da0aa5e641 100644 --- a/install.ps1 +++ b/install.ps1 @@ -171,13 +171,14 @@ $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', 'Do you want to install Spicetify Marketplace?', ('&Yes', '&No'), 0) if ($choice -eq 1) { Write-Host -Object 'Spicetify Marketplace installation aborted' - exit } -Write-Verbose -Message 'Starting the Spicetify Marketplace installation script..' -Verbose -$Parameters = @{ - Uri = 'https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1' - UseBasicParsing = $true +else { + Write-Verbose -Message 'Starting the Spicetify Marketplace installation script..' -Verbose + $Parameters = @{ + Uri = 'https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1' + UseBasicParsing = $true + } + Invoke-WebRequest @Parameters | Invoke-Expression } -Invoke-WebRequest @Parameters | Invoke-Expression #endregion Marketplace #endregion Main From 023b8ec22d12ab19b1d84a008f9810b89e4bafc9 Mon Sep 17 00:00:00 2001 From: Grigory Date: Sun, 10 Dec 2023 23:35:43 +0500 Subject: [PATCH 10/14] "PATH variable" -> "PATH" --- install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index da0aa5e641..1bc31645d8 100644 --- a/install.ps1 +++ b/install.ps1 @@ -100,7 +100,7 @@ function Add-SpicetifyToPath { [CmdletBinding()] param () begin { - Write-Verbose -Message 'Adding Spicetify to your PATH variable if needed...' -Verbose + Write-Verbose -Message 'Adding Spicetify to your PATH if needed...' -Verbose $user = [EnvironmentVariableTarget]::User $path = [Environment]::GetEnvironmentVariable('PATH', $user) } From 853e6f3a934846267e00e70627018fb29946419e Mon Sep 17 00:00:00 2001 From: Grigory Date: Sun, 10 Dec 2023 23:37:51 +0500 Subject: [PATCH 11/14] add pause before exit if script was run as admin --- install.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/install.ps1 b/install.ps1 index 1bc31645d8..4331ff8dc2 100644 --- a/install.ps1 +++ b/install.ps1 @@ -155,6 +155,7 @@ if (Test-Admin) { $choice = $Host.UI.PromptForChoice('', 'Do you want to abort the installation process to avoid any issues?', ('&Yes', '&No'), 0) if ($choice -eq 0) { Write-Host -Object 'Spicetify installation aborted' + Pause exit } } From 4c440863c923cadecd6cd9bc9bdd8fbb717c91af Mon Sep 17 00:00:00 2001 From: Grigory Date: Mon, 18 Dec 2023 17:52:49 +0500 Subject: [PATCH 12/14] change info messages style --- install.ps1 | 58 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/install.ps1 b/install.ps1 index 4331ff8dc2..51fd7935f8 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,28 @@ function Write-Success { [CmdletBinding()] param () process { - Write-Host -Object 'Success' -ForegroundColor 'Green' + Write-Host -Object ' > OK' -ForegroundColor 'Green' + } +} + +function Write-Unsuccess { + [CmdletBinding()] + param () + process { + Write-Host -Object ' > ERROR' -ForegroundColor 'Red' + } +} + +function Write-Action { + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + [string]$Message, + + [switch]$NoNewLine + ) + process { + Write-Host -Object $Message -ForegroundColor 'Cyan' -NoNewline:$NoNewLine } } @@ -19,11 +40,11 @@ function Test-Admin { [CmdletBinding()] param () begin { - Write-Verbose -Message 'Checking if the script was ran as Administrator...' -Verbose + Write-Action -Message "Checking if the script wasn't ran as Administrator..." -NoNewLine } process { $currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) - $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) + -not $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) } } @@ -34,7 +55,7 @@ function Test-PowerShellVersion { $PSMinVersion = [version]'5.1' } process { - Write-Verbose -Message 'Checking your PowerShell version...' -Verbose + Write-Action -Message 'Checking if your PowerShell version is compatible...' -NoNewLine $PSVersionTable.PSVersion -ge $PSMinVersion } } @@ -44,7 +65,7 @@ function Move-OldSpicetifyFolder { param () process { if (Test-Path -Path $spicetifyOldFolderPath) { - Write-Verbose -Message 'Moving your old Spicetify folder...' -Verbose + Write-Action -Message 'Moving your old Spicetify folder...' -NoNewLine Copy-Item -Path "$spicetifyOldFolderPath\*" -Destination $spicetifyFolderPath -Recurse -Force Remove-Item -Path $spicetifyOldFolderPath -Recurse -Force Write-Success @@ -67,14 +88,13 @@ function Get-Spicetify { $targetVersion = $v } else { - Write-Warning -Message "You have spicefied an invalid Spicetify version: $v" - Write-Host -Object 'The version must be in the following format: 1.2.3' + Write-Warning -Message "You have spicefied an invalid Spicetify version: $v `nThe version must be in the following format: 1.2.3" Pause exit } } else { - Write-Verbose -Message 'Fetching the latest Spicetify version...' -Verbose + Write-Action -Message 'Fetching the latest Spicetify version...' -NoNewLine $latestRelease = Invoke-RestMethod -Uri 'https://api.github.com/repos/spicetify/spicetify-cli/releases/latest' $targetVersion = $latestRelease.tag_name -replace 'v', '' Write-Success @@ -82,7 +102,7 @@ function Get-Spicetify { $archivePath = "$env:TEMP\spicetify.zip" } process { - Write-Verbose -Message "Downloading Spicetify v$targetVersion..." -Verbose + Write-Action -Message "Downloading Spicetify v$targetVersion..." -NoNewLine $Parameters = @{ Uri = "https://github.com/spicetify/spicetify-cli/releases/download/v$targetVersion/spicetify-$targetVersion-windows-$architecture.zip" UseBasicParsin = $true @@ -100,7 +120,7 @@ function Add-SpicetifyToPath { [CmdletBinding()] param () begin { - Write-Verbose -Message 'Adding Spicetify to your PATH if needed...' -Verbose + Write-Action -Message 'Adding Spicetify to your PATH if needed...' -NoNewLine $user = [EnvironmentVariableTarget]::User $path = [Environment]::GetEnvironmentVariable('PATH', $user) } @@ -121,11 +141,11 @@ function Install-Spicetify { [CmdletBinding()] param () begin { - Write-Verbose -Message 'Installing Spicetify...' -Verbose + Write-Action -Message 'Installing Spicetify...' } process { $archivePath = Get-Spicetify - Write-Verbose -Message 'Extracting Spicetify...' -Verbose + Write-Action -Message 'Extracting Spicetify...' -NoNewLine Expand-Archive -Path $archivePath -DestinationPath $spicetifyFolderPath -Force Write-Success Add-SpicetifyToPath @@ -140,6 +160,7 @@ function Install-Spicetify { #region Main #region Checks if (-not (Test-PowerShellVersion)) { + Write-Unsuccess Write-Warning -Message 'PowerShell 5.1 or higher is required to run this script' Write-Warning -Message "You are running PowerShell $($PSVersionTable.PSVersion)" Write-Host -Object 'PowerShell 5.1 install guide:' @@ -149,7 +170,11 @@ if (-not (Test-PowerShellVersion)) { Pause exit } -if (Test-Admin) { +else { + Write-Success +} +if (-not (Test-Admin)) { + Write-Unsuccess Write-Warning -Message "The script was ran as Administrator which isn't recommended" $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', 'Do you want to abort the installation process to avoid any issues?', ('&Yes', '&No'), 0) @@ -159,6 +184,9 @@ if (Test-Admin) { exit } } +else { + Write-Success +} #endregion Checks #region Spicetify @@ -171,10 +199,10 @@ Write-Host -Object 'Run spicetify -h to get started' $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', 'Do you want to install Spicetify Marketplace?', ('&Yes', '&No'), 0) if ($choice -eq 1) { - Write-Host -Object 'Spicetify Marketplace installation aborted' + Write-Host -Object 'Spicetify Marketplace installation aborted' -ForegroundColor 'Yellow' } else { - Write-Verbose -Message 'Starting the Spicetify Marketplace installation script..' -Verbose + Write-Action -Message 'Starting the Spicetify Marketplace installation script..' $Parameters = @{ Uri = 'https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1' UseBasicParsing = $true From 0a3a2dc9b4de1766554d1dd63673592a567c58af Mon Sep 17 00:00:00 2001 From: Grigory Date: Sat, 23 Dec 2023 01:46:21 +0500 Subject: [PATCH 13/14] output style changes --- install.ps1 | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/install.ps1 b/install.ps1 index 51fd7935f8..270b0e6105 100644 --- a/install.ps1 +++ b/install.ps1 @@ -23,24 +23,11 @@ function Write-Unsuccess { } } -function Write-Action { - [CmdletBinding()] - param ( - [Parameter(Mandatory)] - [string]$Message, - - [switch]$NoNewLine - ) - process { - Write-Host -Object $Message -ForegroundColor 'Cyan' -NoNewline:$NoNewLine - } -} - function Test-Admin { [CmdletBinding()] param () begin { - Write-Action -Message "Checking if the script wasn't ran as Administrator..." -NoNewLine + Write-Host -Object "Checking if the script wasn't ran as Administrator..." -NoNewline } process { $currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) @@ -55,7 +42,7 @@ function Test-PowerShellVersion { $PSMinVersion = [version]'5.1' } process { - Write-Action -Message 'Checking if your PowerShell version is compatible...' -NoNewLine + Write-Host -Object 'Checking if your PowerShell version is compatible...' -NoNewline $PSVersionTable.PSVersion -ge $PSMinVersion } } @@ -65,7 +52,7 @@ function Move-OldSpicetifyFolder { param () process { if (Test-Path -Path $spicetifyOldFolderPath) { - Write-Action -Message 'Moving your old Spicetify folder...' -NoNewLine + Write-Host -Object 'Moving your old Spicetify folder...' -NoNewline Copy-Item -Path "$spicetifyOldFolderPath\*" -Destination $spicetifyFolderPath -Recurse -Force Remove-Item -Path $spicetifyOldFolderPath -Recurse -Force Write-Success @@ -94,7 +81,7 @@ function Get-Spicetify { } } else { - Write-Action -Message 'Fetching the latest Spicetify version...' -NoNewLine + Write-Host -Object 'Fetching the latest Spicetify version...' -NoNewline $latestRelease = Invoke-RestMethod -Uri 'https://api.github.com/repos/spicetify/spicetify-cli/releases/latest' $targetVersion = $latestRelease.tag_name -replace 'v', '' Write-Success @@ -102,7 +89,7 @@ function Get-Spicetify { $archivePath = "$env:TEMP\spicetify.zip" } process { - Write-Action -Message "Downloading Spicetify v$targetVersion..." -NoNewLine + Write-Host -Object "Downloading Spicetify v$targetVersion..." -NoNewline $Parameters = @{ Uri = "https://github.com/spicetify/spicetify-cli/releases/download/v$targetVersion/spicetify-$targetVersion-windows-$architecture.zip" UseBasicParsin = $true @@ -120,7 +107,7 @@ function Add-SpicetifyToPath { [CmdletBinding()] param () begin { - Write-Action -Message 'Adding Spicetify to your PATH if needed...' -NoNewLine + Write-Host -Object 'Adding Spicetify to your PATH if needed...' -NoNewline $user = [EnvironmentVariableTarget]::User $path = [Environment]::GetEnvironmentVariable('PATH', $user) } @@ -141,18 +128,18 @@ function Install-Spicetify { [CmdletBinding()] param () begin { - Write-Action -Message 'Installing Spicetify...' + Write-Host -Object 'Installing Spicetify...' } process { $archivePath = Get-Spicetify - Write-Action -Message 'Extracting Spicetify...' -NoNewLine + Write-Host -Object 'Extracting Spicetify...' -NoNewline Expand-Archive -Path $archivePath -DestinationPath $spicetifyFolderPath -Force Write-Success Add-SpicetifyToPath } end { Remove-Item -Path $archivePath -Force - Write-Host -Object 'Spicetify was successfully installed' -ForegroundColor 'Green' + Write-Host -Object 'Spicetify was successfully installed!' -ForegroundColor 'Green' } } #endregion Functions @@ -179,7 +166,7 @@ if (-not (Test-Admin)) { $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', 'Do you want to abort the installation process to avoid any issues?', ('&Yes', '&No'), 0) if ($choice -eq 0) { - Write-Host -Object 'Spicetify installation aborted' + Write-Host -Object 'Spicetify installation aborted' -ForegroundColor 'Yellow' Pause exit } @@ -192,17 +179,19 @@ else { #region Spicetify Move-OldSpicetifyFolder Install-Spicetify -Write-Host -Object 'Run spicetify -h to get started' +Write-Host -Object "`nRun" -NoNewline +Write-Host -Object ' spicetify -h ' -NoNewline -ForegroundColor 'Cyan' +Write-Host -Object 'to get started' #endregion Spicetify #region Marketplace $Host.UI.RawUI.Flushinputbuffer() -$choice = $Host.UI.PromptForChoice('', 'Do you want to install Spicetify Marketplace?', ('&Yes', '&No'), 0) +$choice = $Host.UI.PromptForChoice('', "`nDo you want to install Spicetify Marketplace?", ('&Yes', '&No'), 0) if ($choice -eq 1) { Write-Host -Object 'Spicetify Marketplace installation aborted' -ForegroundColor 'Yellow' } else { - Write-Action -Message 'Starting the Spicetify Marketplace installation script..' + Write-Host -Object 'Starting the Spicetify Marketplace installation script..' $Parameters = @{ Uri = 'https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1' UseBasicParsing = $true From 3f8792bce270ad7567ee0663c1e1fb36fb8ed653 Mon Sep 17 00:00:00 2001 From: ririxi Date: Wed, 27 Dec 2023 16:21:24 +0100 Subject: [PATCH 14/14] style: lowercase the `spicetify` word --- install.ps1 | 33 ++++++++++++++++++++++----------- install.sh | 6 +++--- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/install.ps1 b/install.ps1 index 270b0e6105..a75fd71c0f 100644 --- a/install.ps1 +++ b/install.ps1 @@ -52,7 +52,8 @@ function Move-OldSpicetifyFolder { param () process { if (Test-Path -Path $spicetifyOldFolderPath) { - Write-Host -Object 'Moving your old Spicetify folder...' -NoNewline + Write-Host -Object 'Moving the old spicetify folder...' -NoNewline + Copy-Item -Path "$spicetifyOldFolderPath\*" -Destination $spicetifyFolderPath -Recurse -Force Remove-Item -Path $spicetifyOldFolderPath -Recurse -Force Write-Success @@ -75,13 +76,15 @@ function Get-Spicetify { $targetVersion = $v } else { - Write-Warning -Message "You have spicefied an invalid Spicetify version: $v `nThe version must be in the following format: 1.2.3" + Write-Warning -Message "You have spicefied an invalid spicetify version: $v `nThe version must be in the following format: 1.2.3" + Pause exit } } else { - Write-Host -Object 'Fetching the latest Spicetify version...' -NoNewline + Write-Host -Object 'Fetching the latest spicetify version...' -NoNewline + $latestRelease = Invoke-RestMethod -Uri 'https://api.github.com/repos/spicetify/spicetify-cli/releases/latest' $targetVersion = $latestRelease.tag_name -replace 'v', '' Write-Success @@ -89,7 +92,8 @@ function Get-Spicetify { $archivePath = "$env:TEMP\spicetify.zip" } process { - Write-Host -Object "Downloading Spicetify v$targetVersion..." -NoNewline + Write-Host -Object "Downloading spicetify v$targetVersion..." -NoNewline + $Parameters = @{ Uri = "https://github.com/spicetify/spicetify-cli/releases/download/v$targetVersion/spicetify-$targetVersion-windows-$architecture.zip" UseBasicParsin = $true @@ -107,7 +111,8 @@ function Add-SpicetifyToPath { [CmdletBinding()] param () begin { - Write-Host -Object 'Adding Spicetify to your PATH if needed...' -NoNewline + Write-Host -Object 'Making spicetify available in the PATH...' -NoNewline + $user = [EnvironmentVariableTarget]::User $path = [Environment]::GetEnvironmentVariable('PATH', $user) } @@ -128,18 +133,21 @@ function Install-Spicetify { [CmdletBinding()] param () begin { - Write-Host -Object 'Installing Spicetify...' + Write-Host -Object 'Installing spicetify...' + } process { $archivePath = Get-Spicetify - Write-Host -Object 'Extracting Spicetify...' -NoNewline + Write-Host -Object 'Extracting spicetify...' -NoNewline + Expand-Archive -Path $archivePath -DestinationPath $spicetifyFolderPath -Force Write-Success Add-SpicetifyToPath } end { Remove-Item -Path $archivePath -Force - Write-Host -Object 'Spicetify was successfully installed!' -ForegroundColor 'Green' + Write-Host -Object 'spicetify was successfully installed!' -ForegroundColor 'Green' + } } #endregion Functions @@ -166,7 +174,8 @@ if (-not (Test-Admin)) { $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', 'Do you want to abort the installation process to avoid any issues?', ('&Yes', '&No'), 0) if ($choice -eq 0) { - Write-Host -Object 'Spicetify installation aborted' -ForegroundColor 'Yellow' + Write-Host -Object 'spicetify installation aborted' -ForegroundColor 'Yellow' + Pause exit } @@ -188,10 +197,12 @@ Write-Host -Object 'to get started' $Host.UI.RawUI.Flushinputbuffer() $choice = $Host.UI.PromptForChoice('', "`nDo you want to install Spicetify Marketplace?", ('&Yes', '&No'), 0) if ($choice -eq 1) { - Write-Host -Object 'Spicetify Marketplace installation aborted' -ForegroundColor 'Yellow' + Write-Host -Object 'spicetify Marketplace installation aborted' -ForegroundColor 'Yellow' + } else { - Write-Host -Object 'Starting the Spicetify Marketplace installation script..' + Write-Host -Object 'Starting the spicetify Marketplace installation script..' + $Parameters = @{ Uri = 'https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1' UseBasicParsing = $true diff --git a/install.sh b/install.sh index 96e25b9730..92028a7e27 100755 --- a/install.sh +++ b/install.sh @@ -136,10 +136,10 @@ echo log "spicetify v$tag was installed successfully to $spicetify_install" log "Run 'spicetify --help' to get started" -read -p "Do you want to install Spicetify Marketplace? (Y/n) " choice +read -p "Do you want to install spicetify Marketplace? (Y/n) " choice if [[ $choice == [Nn]* ]]; then - echo "Spicetify Marketplace installation aborted" + echo "spicetify Marketplace installation aborted" exit fi -echo "Starting the Spicetify Marketplace installation script.." +echo "Starting the spicetify Marketplace installation script.." curl -fsSL "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.sh" | sh