0

I'm executing the following shell script on a MAC slave within the Azure DevOps pipeline:

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

This script provides the following output:

[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

I've tried the following variations without success:

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 /

Doing a chmod 777 MonoGame.pkg or executing everything with sudo doesn't change anything either.

Any idea why the package is not found? (I don't know a lot about MAC, I just plan on using it for CI)

Is the message maybe misleading and the package itself is invalid (rather than the path to it?)

Tim Meyer
  • 12,210
  • 8
  • 64
  • 97

1 Answers1

0

The error message is in fact misleading: The path to the package is correct, but the package itself is not a valid package.

Downloading the package in a git bash via curl results in a file with the following content:

<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>

Obviously, this can't be installed as a package.

Fixing the download by making it follow redirects in accordance with this answer fixes the problem.

Tim Meyer
  • 12,210
  • 8
  • 64
  • 97
  • Thanks for reminding me. I waited for the two day timeout before being able to accept it and eventually forgot about it. – Tim Meyer Apr 17 '19 at 21:45