Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure post-install script to only operate when platform installed on Linux machine #356

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Jul 30, 2024

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:

Configuring platform.
Please run as root

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 (#334). 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. For example:

Configuring platform.

You might need to configure permissions for uploading.
To do so, run the following command from the terminal:
sudo "/Users/per/Library/Arduino15/packages/arduino/hardware/renesas_uno/42.0.0/post_install.sh"

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:

Configuring platform.

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.


Related: arduino/ArduinoCore-mbed#932

… on Linux machine

The Arduino Boards Manager automatically executes the `post_install.sh` script during installation of the platform on a
non-Windows machine.

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:

```
Configuring platform.
Please run as root
```

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.
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. For example:

```
Configuring platform.

You might need to configure permissions for uploading.
To do so, run the following command from the terminal:
sudo "/Users/per/Library/Arduino15/packages/arduino/hardware/renesas_uno/42.0.0/post_install.sh"
```

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:

```
Configuring platform.
```

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, which has withstood the test of time after years of use by
a large user base.
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: infrastructure Related to project infrastructure labels Jul 30, 2024
@per1234 per1234 requested a review from facchinm July 30, 2024 09:55
@facchinm facchinm merged commit a430d9f into arduino:main Jul 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants