From 4aaba1f7298ea1d32b7557a3365e4cc07920d348 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Sat, 30 Mar 2019 00:01:03 +0800 Subject: [PATCH 1/2] auto uninstall --- libexec/scoop-install.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libexec/scoop-install.ps1 b/libexec/scoop-install.ps1 index a4ab77362e..e7f0ade0c8 100644 --- a/libexec/scoop-install.ps1 +++ b/libexec/scoop-install.ps1 @@ -39,7 +39,9 @@ function is_installed($app, $global) { $version = @(versions $app $global)[-1] if (!(install_info $app $version $global)) { - error "It looks like a previous installation of $app failed.`nRun 'scoop uninstall $app$(gf $global)' before retrying the install." + warn "Purging previous failed installation of $app." + & "$PSScriptRoot\scoop-uninstall.ps1" $app $(if ($global) { "--global" }) + return $false } warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(gf $global)' to install a new version." return $true From d91350843054ef172f9873ec43e2473aece3dc0b Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Thu, 19 Dec 2019 15:30:10 +0800 Subject: [PATCH 2/2] Some tweaks --- libexec/scoop-install.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libexec/scoop-install.ps1 b/libexec/scoop-install.ps1 index e7f0ade0c8..c781ba854f 100644 --- a/libexec/scoop-install.ps1 +++ b/libexec/scoop-install.ps1 @@ -40,7 +40,7 @@ function is_installed($app, $global) { $version = @(versions $app $global)[-1] if (!(install_info $app $version $global)) { warn "Purging previous failed installation of $app." - & "$PSScriptRoot\scoop-uninstall.ps1" $app $(if ($global) { "--global" }) + & "$PSScriptRoot\scoop-uninstall.ps1" $app$(gf $global) return $false } warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(gf $global)' to install a new version." @@ -96,7 +96,8 @@ if ($specific_versions.length -gt 0) { $specific_versions_paths = $specific_versions | ForEach-Object { $app, $bucket, $version = parse_app $_ if (installed_manifest $app $version) { - abort "'$app' ($version) is already installed.`nUse 'scoop update $app$global_flag' to install a new version." + warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(if ($global) { " --global" })' to install a new version." + continue } generate_user_manifest $app $bucket $version