Issue
Aditya Patwardhan (@adityapatwardhan) so I found out what is going on. When the the installation of PowerShell occurs it is actually recognizing the app that exists in the packaging folder and updating the copy there tools/packaging/macos/launcher/ROOT/Applications/PowerShell.app instead of installing it to /Applications as you would think. Since it gets installed as root:wheel 755 you lose access to the files.
The behavior may seem like madness but it makes sense as apps can be installed pretty much anywhere you like. Being able automatically find these instances is beneficial.
This issue only occurs on a machine with build on it. I verified that a vanilla High Sierra does not have this issue with just the installation from .pkg.
I'm afraid moving it to different temporary folder will probably not work as it will get picked up there too. My intuition is one the the identifiers in Info.plist is triggering its pickup. Removing the tools/packaging/macos/launcher/ROOT/Applications/PowerShell.app folder prior to installation does fix the issue.
Possible solutions
- Remove the macOS app folder just after
fpm runs here. Not the best but maybe good enough for getting past CI.
- Have packaging build the macOS app procedurally as it is simple a few files and folders then remove the folder after packaging, same as in 1. This has the advantage of not having the folder structure and files in the repo directly as they can be generated at will.
- Figure out what is triggering the capture of the build staging launcher and make a change to the plist and/or structure to prevent if from being picked up post
fpm.
Also for anyone wanting to try to repro this to uninstall PowerShell from macOS you should be using the following. I will get documentation updated soon with the below.
sudo rm -rf /usr/local/microsoft /usr/local/bin/pwsh /Applications/PowerShell.app /usr/local/share/man/man1/pwsh.1.gz
sudo pkgutil --forget powershell
/cc Travis Plunk (@TravisEz13)