Configure post-install script to only operate when platform installed on Linux machine #932
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Arduino Boards Manager automatically executes the
post_install.sh
script during installation of the platform on a non-Windows machine:https://arduino.github.io/arduino-cli/dev/platform-specification/#post-install-script
The platform's post-install script is Linux-specific, but no provisions were made in the script code for the fact that it is also executed on macOS machines. Previously, this was fairly innocuous because, although misleading, the message printed to the output during the platform installation was short and cryptic and thus easy for the average macOS user to ignore:
Since it is important for Linux users to manually run the script and the previous message did not effectively communicate that, the script was recently modified to print helpful instructions during the Boards Manager installation (#893). The fact that the script is also executed on macOS machines was not considered in that work. This meant that, although an improvement for the Linux user experience was accomplished, the macOS user experience was worsened because those users were then presented with more prominent and detailed inappropriate instructions than the former easy to miss "Please run as root" instruction. For example
The problem is fixed by adjusting the script so that the script simply returns silently if it is invoked on a non-Linux machine. macOS users will now only see the following benign message in the output during the Boards Manager installation:
Additional context
The POSIX-compliant shell code for determining the operating system the script is running under was derived from the Arduino CLI application's cross-platform installation script:
https://github.com/arduino/arduino-cli/blob/v1.0.3/install.sh#L61-L70
That code has withstood the test of time after years of use by a large user base.
Originally reported at:
I also remember seeing a prior comment about the issue, I believe in this repository, but I could not manage to find it.