代码之家  ›  专栏  ›  技术社区  ›  Tim Meyer

在azure devops mac slave上找不到安装程序包

  •  0
  • Tim Meyer  · 技术社区  · 6 年前

    我正在azure devops管道中的mac从机上执行以下shell脚本:

    #!/bin/bash
    curl -O https://github.com/MonoGame/MonoGame/releases/download/v3.7.1/MonoGame.pkg
    ls -l
    sudo installer -pkg MonoGame.pkg -target /
    

    此脚本提供以下输出:

    [command]/bin/bash /Users/vsts/agent/2.149.2/work/1/s/azure/install.sh
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100   601    0   601    0     0   1090      0 --:--:-- --:--:-- --:--:--  1096
    total 16
    
    -rw-r--r--  1 vsts  staff  601 Apr  6 10:17 MonoGame.pkg
    -rw-r--r--  1 vsts  staff  143 Apr  6 10:17 install.sh
    
    installer: Error the package path specified was invalid: 'MonoGame.pkg'. 
    
    ##[error]/bin/bash failed with return code: 1
    ##[error]Bash failed with error: /bin/bash failed with return code: 1
    

    我尝试过以下几种变体,但都没有成功:

    sudo installer -pkg MonoGame.pkg -target /
    sudo installer -pkg "MonoGame.pkg" -target /
    sudo installer -pkg "./MonoGame.pkg" -target /
    sudo installer -pkg "$(pwd)/MonoGame.pkg" -target /
    

    做某事 chmod 777 MonoGame.pkg 或者用sudo执行任何事情也不会改变任何事情。

    知道为什么没有找到包裹吗?(我对Mac不太了解,我只是打算把它用于CI)

    消息是否可能会误导用户,并且包本身是无效的(而不是指向它的路径?)

    0 回复  |  直到 6 年前
        1
  •  0
  •   Tim Meyer    6 年前

    错误消息实际上是误导性的:包的路径是正确的,但包本身不是有效的包。

    在中下载包 git bash 通过 curl 生成包含以下内容的文件:

    <html><body>You are being <a href="https://github-production-release-asset-2e65be.s3.amazonaws.com/1579990/3a223380-fad8-11e8-82f6-eae8d42e5ce3?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190406%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20190406T114805Z&amp;X-Amz-Expires=300&amp;X-Amz-Signature=73828664c94a3ba757f52e1cc1e5e6267082dd23d70b3e39f743874c844006a2&amp;X-Amz-SignedHeaders=host&amp;actor_id=0&amp;response-content-disposition=attachment%3B%20filename%3DMonoGame.pkg&amp;response-content-type=application%2Foctet-stream">redirected</a>.</body></html>
    

    显然,这不能作为包安装。

    通过按照 this answer 解决了这个问题。

    推荐文章