whoopscs / scoop-security

用于渗透测试和网络安全相关工具下载、安装和自动更新的Scoop软件仓库。Scoop bucket for Penetration Testing and Cybersecurity related tools.
24 stars 6 forks source link

[Bug]: gogo安装失败 #5

Open 96368a opened 6 hours ago

96368a commented 6 hours ago

Prerequisites

Package Name

gogo

Expected/Current Behaviour

使用scoop install gogo安装时失败,报错如下

Creating shim for 'gogo'.
Get-Command: C:\Users\Ender\scoop\apps\scoop\current\lib\install.ps1:757
Line |
 757 |              $bin = (Get-Command $target).Source
     |                      ~~~~~~~~~~~~~~~~~~~
     | The term 'gogo.exe' is not recognized as a name of a cmdlet, function, script file, or executable program.
     | Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Can't shim 'gogo.exe': File doesn't exist.

排查发现下载的文件名为gogo_windows_amd64.exe而不是gogo.exe,应该是这个问题导致的

Steps to Reproduce

❯ scoop install gogo
Installing 'gogo' (2.13.4) [64bit] from 'sec' bucket
Loading gogo_windows_amd64.exe from cache
Checking hash of gogo_windows_amd64.exe ... ok.
Linking ~\scoop\apps\gogo\current => ~\scoop\apps\gogo\2.13.4
Creating shim for 'gogo'.
Get-Command: C:\Users\Ender\scoop\apps\scoop\current\lib\install.ps1:757
Line |
 757 |              $bin = (Get-Command $target).Source
     |                      ~~~~~~~~~~~~~~~~~~~
     | The term 'gogo.exe' is not recognized as a name of a cmdlet, function, script file, or executable program.
     | Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Can't shim 'gogo.exe': File doesn't exist.

Possible Solution

使用pre_install在创建shim前重命名文件

    "pre_install": [
        "if (Test-Path \"$dir\\gogo_windows_amd64.exe\") {",
        "    Rename-Item \"$dir\\gogo_windows_amd64.exe\" \"$dir\\gogo.exe\"",
        "} elseif (Test-Path \"$dir\\gogo_windows_386.exe\") {",
        "    Rename-Item \"$dir\\gogo_windows_386.exe\" \"$dir\\gogo.exe\"",
        "}"
    ],

### Scoop and Buckets Version

```console
❯ scoop --version
Current Scoop version:
859d1db5 (HEAD -> master, tag: v0.5.2, origin/master, origin/HEAD) chore(release): Bump to version 0.5.2 (#6080)

'main' bucket:
7523a98b7 (HEAD -> master, origin/master, origin/HEAD) mariadb@11.5.2: Fix download url & autoupdate (#6269)

'versions' bucket:
29b03e5ef (HEAD -> master, origin/master, origin/HEAD) swift-nightly: Update to version 20241022.1

'sec' bucket:
03abab7 (HEAD -> main, origin/main, origin/HEAD) proguard: Update to version 7.6.0

Scoop Config

❯ scoop config

last_update         scoop_repo                              scoop_branch proxy
-----------         ----------                              ------------ -----
2024-10-22 23:47:58 https://github.com/ScoopInstaller/Scoop master

PowerShell Version

❯ $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.5
PSEdition                      Core
GitCommitId                    7.4.5
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional Softwares

No response

96368a commented 6 hours ago

提交了一个pr来修复这个问题 #6